ghostscript

Convert: Postscript delegate failed

眉间皱痕 提交于 2019-11-29 04:49:06
问题 I am trying to convert a PDF to JPEG: $ convert pdf-test.pdf pdf-test.pdf.jpg However, I am getting this error: convert: Postscript delegate failed `pdf-test.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/664. convert: missing an image filename `pdf-test.pdf.jpg' @ error/convert.c/ConvertImageCommand/3015. Currently I am using this version of GS and ImageMagick on Mac OS X Lion: $ gs -v GPL Ghostscript 9.02 (2011-03-30) Copyright (C) 2010 Artifex Software, Inc. All rights reserved

How to determine string height in PostScript?

这一生的挚爱 提交于 2019-11-29 03:50:44
I need to determine the height of a string (in given scale and font) in postscript. /Helvetic-Oblique findfont 10 scalefont setfont 10 10 1 0 360 arc fill 10 10 moveto (test) dup stringwidth pop 2 div neg 0 rmoveto show will print test centered horizontally (but not yet vertically) at (10,10). (to see this, I also show a small circle at 10,10). I also need to determine the string height to center the text vertically as well, but I cant find a function for it. Are you familiar with the PostScript code you're using? Or is it just blindly copied and pasted from someplace? If you want to

Cropping a PDF / Adding crop box using Ghostscript

↘锁芯ラ 提交于 2019-11-29 02:17:22
I have a few hundred PDFs that I need to crop - I'm willing to either crop the actual documents or simply add a crop box to each so the correct viewable area shows when the PDF is opened. How can I do this using Ghostscript (v8.71)? I found this: gs -sDEVICE=pdfwrite -sOutputFile=marked.pdf [/CropBox [54 54 1314 810] /PAGES pdfmark original.pdf I've tried this (and all variants I can think of) but I always get an error such as this: Error: /undefinedfilename in ([/CropBox) I've tried moving around the parameters of the command but nothing seems to work. Does anyone know how this can be

How can I merge PDF files (or PS if not possible) such that every file will begin in a odd page?

浪尽此生 提交于 2019-11-29 01:53:14
I am working on a UNIX system and I'd like to merge thousands of PDF files into one file in order to print it. I don't know how many pages they are in advance. I'd like to print it double sided, such that two files will not be on the same page. Therefore it I'd the merging file to be aligned such that every file will begin in odd page and a blank page will be added if the next place to write is an even page. Here's the solution I use (it's based on @Dingo's basic principle, but uses an easier approach for the PDF manipulation): First, I create a PDF file with a single blank page somewhere, e.g

How to convert a PDF to grayscale from command line avoiding to be rasterized?

纵饮孤独 提交于 2019-11-28 23:19:58
I'm trying to convert to grayscale this PDF: https://dl.dropboxusercontent.com/u/10351891/page-27.pdf Ghostscript (v 9.10) with pdfwrite Device fails with a "Unable to convert color space to Gray, reverting strategy to LeaveColorUnchanged." message. I'm able to convert it through an intermediary ps file (using gs, pdftops (v 0.24.3) or pdf2ps) but this convertion rasterize the whole PDF. I tryed a lot of other things: normalize the PDF using qpdf (v 5.0.1) or pdftk (v 1.44), transform it to a svg file and back to a PDF via Inkscape (v 0.48.4)... nothing seems to work. The only one solution I

Ghostscript: PDF total pages

落爺英雄遲暮 提交于 2019-11-28 23:13:58
I'm using Ghostscript library API (wrapping from C#) to print PDF documents from my application. With the ' -dFirstPage ' and ' -dLastPage ' parameters I'm able to select an range of pages to be printed, but how about the total number of a PDF's pages? It is not very nice to allow a user to select a page interval from 2 to 10 when, let me say, the PDF document has only 4 pages. Consider that I'm using Ghostscript library through the gsapi_init_with_args API library call. Ghostscript can count and display the number of pages of a PDF on stdout . The commandline is gswin32c ^ -q ^ -dNODISPLAY ^

Simple VB.Net Wrapper for Ghostscript Dll [closed]

隐身守侯 提交于 2019-11-28 19:43:23
I love Ghostscript. You can use it to convert pdf's to graphics files, split and/or merge pdf files, make thumbnails, and a whole bunch of other stuff. And, it's free, open-source software! There are scads of posts on web sites on how to use Ghostscript from the command line for all sorts of platforms. But, I could never find a simple vb.net dll wrapper that used the Ghostscript dll (gsdll32.dll) instead of starting a process to run the Ghostscript command line app. So, I came up with this code. I am posting it here in hopes that others can avoid the frustration I felt looking for something

ImageMagick/Imagick convert PDF to JPG using native PHP API

懵懂的女人 提交于 2019-11-28 18:55:12
I’m attempting to convert PDF files into PNGs. It works great from the command line (I do have GhostScript 8.64 installed). But from PHP I’m having a problem: code: $im = new Imagick($pdf_file); // this is where it throws the exception below output: Fatal error: Uncaught exception ‘ImagickException’ with message ‘Postscript delegate failed `23_1235606503.pdf’: No such file or directory @ pdf.c/ReadPDFImage/612′ in get_thumbnail.php:93 Stack trace: \#0 get_thumbnail.php(93): Imagick->__construct(’…’) etc. etc. I'm not sure what I'm doing wrong here, but I suspect it has something to do with my

Replace all font glyphs in a PDF by converting them to outline shapes

不想你离开。 提交于 2019-11-28 18:52:12
I am looking for a way to 'outline' all text/fonts in a PDF file, i.e. convert them to curves. I would prefer to do this without having to convert the PDF to PostScript and back. Also, I would like to use free lightweight cross-platform tools that can be automated from the command line, such as Ghostscript or MuPDF. Yes, you can use Ghostscript to achieve what you want. I. For Ghostscript versions up to 9.14 You need to go through 2 steps: Convert the PDF to a PostScript file, but use the side effect of a relatively unknown parameter: it is called -dNOCACHE . This will convert all used fonts

How to set custom page size with Ghostscript

荒凉一梦 提交于 2019-11-28 18:46:59
I have scanned some materials at 600 dpi, ~ 9.36x12.67 inches and prepared in PostScript (PS) format. Now when I try to transform PS to PDF with Ghostscript (GS), I get clipped output, as I assume GS's default page size is set to A4. I found available templates for GS here: http://www.ghostscript.com/doc/9.06/Use.htm#Known_paper_sizes but none matches closely to dimensions of my PS files, so: Can I instruct GS to output custom size, and if so how? -sPAPERSIZE instruction seem to accept only predefined templates name, as in linked documentation. You can set the used page size with -gNNNNxMMMM