ghostscript

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

我怕爱的太早我们不能终老 提交于 2019-11-27 14:41:09
问题 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

Querying Ghostscript for the default options/settings of an output device (such as 'pdfwrite' or 'tiffg4')

隐身守侯 提交于 2019-11-27 14:32:10
In this answer to 'GhostScript command line parameters to convert EPS to PDF' ; it is stated that the default resolution for the pdfwrite device of Ghostscript is 720x720, which I initially found unbelievable! Is there a way to list the default options of a Ghostscript device? Since Ghostscript is a full-blown PostScript interpreter, you can also send PostScript snippets to it which do not cause the drawing of page elements, but which query it for its internal state. If you want to know what the default settings of the Display are, when you ask it via gs some.pdf to just display a PDF on

How can I shift page images in PDF files more to the left or to the right?

佐手、 提交于 2019-11-27 14:26:41
We have a bunch of scanned pages (about 600) for which every PDF viewer displays the image with zero margin on the right edge, but about 2 inch margin on the left. (Presumably while scanning, there was a wrong setting used...) We want to print these pages, preferably as a booklet. Is there a way to permanently shift all page images towards the center and have the PDF display these pages also in a more pleasing way? Can Ghostscript do that? Can one do this with some other method, such as programatically with the help of some PDF processing library? If you don't want to write your own program

Remove all text from PDF file

时间秒杀一切 提交于 2019-11-27 13:17:03
问题 I am using Ghostscript to convert source PDF file into array of PNG images. Before I convert PDF page into PNG image I would need to extract (delete) all text from PDF so that converted page image would contain all other elements, excluding text. Can I achieve this with Ghostscript or will I need to look into different tools? I would also be interested in a tool that can read-save my source PDF removing all the text. 回答1: Since my previous answer, development has continued, and a new option

Add comments to PDF files automagically with regular expressions

一个人想着一个人 提交于 2019-11-27 12:11:34
I've been grading academic papers for a couple of years now and I've started to see numerous patterns in spelling and grammer mistakes. Also, I've noticed that less experienced academics tend to use certain constructs that immediately raise "smells" to more experienced researchers. I would like to automagically recognize and annotate these in PDF files. Is anyone aware of a script that I could use to automagically annotate and comment PDF files? Perhaps it's dead simple, but I feel like I'm one of the first ones to ask this question. Programming is no problem. To solve this task, you need 3

How to set custom page size with Ghostscript

好久不见. 提交于 2019-11-27 11:49:21
问题 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

ImageMagick/Imagick convert PDF to JPG using native PHP API

旧街凉风 提交于 2019-11-27 11:45:10
问题 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->_

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

試著忘記壹切 提交于 2019-11-27 11:43:23
问题 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. 回答1: 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

Using Ghostscript to convert JPEG to PDF

人走茶凉 提交于 2019-11-27 10:49:45
问题 What are the parameters that I should pass? The Ghostscript version I'm using is 8.71. 回答1: gs \ -sDEVICE=pdfwrite \ -o foo.pdf \ /usr/local/share/ghostscript/8.71/lib/viewjpeg.ps \ -c \(my.jpg\) viewJPEG reads my.jpg and produces foo.pdf . You will have to find where your installation installed the PostScript program viewjpeg.ps . 回答2: https://gitlab.mister-muffin.de/josch/img2pdf As mentioned by PleaseStand, GhostScript will decode the JPEG data, resulting in generation loss, as well as

How to downsample images within PDF file?

↘锁芯ラ 提交于 2019-11-27 09:52:52
问题 Need a Java-based solution or, at the worst, command-line for Linux. I tried to use Ghostscript: gs -sDEVICE=pdfwrite -dPDFA -dBATCH -dNOPAUSE -dUseCIEColor \ -sProcessColorModel=DeviceCMYK -sPDFACompatibilityPolicy=1 \ -sOutputFile=downgraded.pdf leon_range_my12_w22_brochure.pdf but I got a lot of errors... 回答1: Here's an example of how you can downsample all (color, gray and mono) images to 72dpi with a Ghostscript commandline: gs \ -o downsampled.pdf \ -sDEVICE=pdfwrite \