ghostscript

Using Ghostscript to convert JPEG to PDF

我的未来我决定 提交于 2019-11-28 17:35:55
What are the parameters that I should pass? The Ghostscript version I'm using is 8.71. Henry 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 . https://gitlab.mister-muffin.de/josch/img2pdf As mentioned by PleaseStand, GhostScript will decode the JPEG data, resulting in generation loss , as well as performance "ten to hundred" times worse than img2pdf. ImageMagick (i.e. convert ) also decodes and re

Any tips for speeding up GhostScript?

烂漫一生 提交于 2019-11-28 17:03:39
I have a 100 page PDF that is about 50 MBs. I am running the script below against it and it's taking about 23 seconds per page. The PDF is a scan of a paper document. gswin32.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dPDFSETTINGS=/screen -sOutputFile=out4.pdf 09.pdf Is there anything I can do to speed this up? I've determined that the -dPDFSettings=/screen is what is making it so slow, but i'm not getting good compression without it... UPDATE: OK I tried updating it to what I have below. Am i using the -c 30000000 setvmthreshold portion correctly? gswin32.exe -dNOPAUSE

How to downsample images within PDF file?

折月煮酒 提交于 2019-11-28 16:43:56
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... 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 \ -dDownsampleColorImages=true \ -dDownsampleGrayImages=true \ -dDownsampleMonoImages=true \ -dColorImageResolution=72 \

Resizing a PDF using Ghostscript

こ雲淡風輕ζ 提交于 2019-11-28 15:22:45
问题 I am trying to scale a PDF which is for example just small of A4 size up to A4. This works fine with portrait documents. The document is scaled up correctly and then padding is added to the top. On landscape documents padding is not added though. Therefor the document will end up being the correct height for A4 but then not wide enough, as padding is not added on the document side (as I hoped). This is what I use to have it working for A4 portrait documents: gs \ -sOutputFile=output.pdf \

How can I make a program overlay text on a postscript file?

拟墨画扇 提交于 2019-11-28 13:00:22
I have some graphs in postscript format, generated by gnuplot. I need to place some identifying information on the graph. How can I script some instructions to do that? I want to write a number at the top right corner of the graph (a .ps file). Ok, the example file you linked to is well behaving (and has not re-defined the showpage operator). So I'm now assuming the following: All your .ps files are similar to your example file. All your .ps files are 1 page only (like .eps files). All your filenames are like constructed as gnp-NNN.ps (like gnp-544.ps is). The number you want to appear in the

What are PostScript dictionaries, and how can they be accessed (via Ghostscript)?

◇◆丶佛笑我妖孽 提交于 2019-11-28 09:26:40
I usually look at ghostscript as a command line tool; however, I never cease to be amazed at the sheer amount of settings and options present there - which is due to the fact that ghostscript is a full blown PostScript language interpreter (which I often forget). For instance, in Querying Ghostscript for the default options/settings of an output device (such as 'pdfwrite' or 'tiffg4') ; one learns how to retrieve default options for a given output device. However, what I'd like to know is - are these options related to so-called PostScript dictionaries? Or, to put it in other words - what are

How to get Ghostscript to use embedded fonts in PDF

∥☆過路亽.° 提交于 2019-11-28 08:43:00
gs -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH \ -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf I'm using (trying anyway) to use Ghostscript to reduce my PDF file size. The command above looks like it works, it reduces file size greatly, but then several of the fields are garbled. As for as I can track it down, It's doing font substitution. IE, The same text = same garbled text. The fonts are embedded in the PDF when it gets to me. Additionally, I have tried to add all the fonts to the Fontmap. Any ideas, Ideally I would like it to use the embedded fonts without me

How to merge two postscript files together?

百般思念 提交于 2019-11-28 07:49:01
I am trying to merge two or more postscript files into one. I tried concatenation but it does not work as each postscript file may have different resource header. Have anyone done this before? Are there any libraries (commercial or open source) out there? I do not mind C++, C# or even Java libraries. Edited These are large postscript files (more than 200 Mb) and their purpose is only for color printing (not for online viewing). Conclusion ps2write is not the answer as it does not support DSC. pswrite as reader pipitas has correctly pointed out produces L1 output. It is not the soluton. Using

Embed ICC color profile in PDF

狂风中的少年 提交于 2019-11-28 07:48:29
I am generating a PDF where all the graphics are drawn in \DeviceRGB in the sRGB color space. I would like to convert the PDF into a different Color Profile using an ICC profile and embed the ICC profile, but I can't find a good tool to do this. I have tried ImageMagick, but that rasterizes the PDF which is undesirable, and I have tried using Ghostscript. But while that converts the colors, it doesn't embed the ICC profile. Is there any tool or library (preferably Java or Scala) available for Linux that does what I want? The Ghostscript commands I have tried are: gs -o cmyk.pdf

Reducing PDF file size using Ghostscript on Linux didn't work

前提是你 提交于 2019-11-28 04:25:32
I have about 50-60 pdf files (images) that are 1.5MB large each. Now I don't want to have such large pdf files in my thesis as that would make downloading, reading and printing a pain in the rear. So I tried using ghostscript to do the following: gs \ -dNOPAUSE -dBATCH \ -sDEVICE=pdfwrite \ -dCompatibilityLevel=1.4 \ -dPDFSETTINGS="/screen" \ -sOutputFile=output.pdf \ L_2lambda_max_1wl_E0_1_zg.pdf However, now my 1.4MB pdf is 1.5MB large. What did I do wrong? Is there some way I can check the resolution of the pdf file? I just need 300dpi images, so would anyone suggest using convert to change