ghostscript

Fit to page size in ghostscript (with a possibly corrupt input)

依然范特西╮ 提交于 2019-11-30 20:27:43
I'm trying to use ghostscript to convert a .ps file to a series of .png files, largely because I don't have a tolerable ps viewer. This is the command I've used: gs -dBATCH -dEPSCrop -dEPSFitPage -sDEVICE=png16m -r300 -dNOPAUSE -sOutputFile=neptune_111115_ob1-2_13pca_boloplots_%d.png neptune_111115_ob1-2_13pca_boloplots.ps (the .ps file is a multi-page postscript). The outputs are partly off the page. I'd like the images to fit inside the page. I can include example files, but they're pretty large - is there any particular part of the .ps file that would be helpful? My suspicion is that the

Setting auto-height/width for converted Jpeg from PDF using GhostScript

隐身守侯 提交于 2019-11-30 19:56:07
I am using GS to do conversion from PDF to JPEG and following is the command that I use: gs -sDEVICE=jpeg -dNOPAUSE -dBATCH -g500x300 -dPDFFitPage -sOutputFile=image.jpg image.pdf In this command as u can see -g500x300 is to set the converted image size (Width x Height). Is there a way to just set the Width without having to input the Height so it will base on the width to scale the height using its original aspect ratio? I know it can be achieved by using ImageMagick convert where you simply put 0 on the height parameter i.e. -resize 500x0 . I tried with GhostScript but I don't think that is

Unable to load library 'gs': libgs.so: cannot open shared object file: No such file or directory

北慕城南 提交于 2019-11-30 19:47:29
问题 I have installed ghostscript of 64 bit on my 64 bit linux machine. I am using ghost4j-0.5.0.jar to convert pdf files to tiff files. I have written a java program which will convert pdf files to tiff files. This is working perfectly fine on Windows but when i thought of moving this to linux machine i am getting the below error. "Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'gs': libgs.so: cannot open shared object file: No such file or directory" I checked

Converting PDF to a collection of images on the server using GhostScript

好久不见. 提交于 2019-11-30 18:19:09
问题 These are the steps I am trying to achieve: Upload a PDF document on the server. Convert the PDF document to a set of images using GhostScript (every page is converted to an image). Send the collection of images back to the client. So far, I am interested in #2 . First, I downloaded both gswin32c.exe and gsdll32.dll and managed to manually convert a PDF to a collection of images(I opened cmd and run the command bellow): gswin32c.exe -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -r150

What is the best way on python 2.3 for windows to execute a program like ghostscript with multiple arguments and spaces in paths?

廉价感情. 提交于 2019-11-30 18:12:48
问题 Surely there is some kind of abstraction that allows for this? This is essentially the command cmd = self._ghostscriptPath + 'gswin32c -q -dNOPAUSE -dBATCH -sDEVICE=tiffg4 -r196X204 -sPAPERSIZE=a4 -sOutputFile="' + tifDest + " " + pdfSource + '"' os.popen(cmd) this way looks really dirty to me, there must be some pythonic way 回答1: Use subprocess, it superseeds os.popen, though it is not much more of an abstraction: from subprocess import Popen, PIPE output = Popen(["mycmd", "myarg"], stdout

can I use Ghostscript to overlay a text (fax) header onto a PDF and/or TIFF?

梦想的初衷 提交于 2019-11-30 16:03:51
I'm writing an application that faxes a document (many supported types) provided by the end user. A requirement is that the end user can also provide text to be used as part of a custom fax header. I've been using Ghostscript to render PDFs as TIFFs and it's been working great so far, but I have yet to find a straightforward way of overlaying the custom header at the top of a PDF. I've tried out a few recommendations: How can I make a program overlay text on a postscript file? How can I add a footer to the bottom of each page of a postscript or pdf file in linux? Add comments to PDF files

PDF compress on CentOS

我怕爱的太早我们不能终老 提交于 2019-11-30 14:59:00
扫描出来的PDF文件都很大,8页12M+, 所以需要压缩. 本来想随便下载一个PDF工具,去做掉. 但是发现,大多数都收费. 也没仔细找免费工具. 去github上转了一圈,发现了一个项目,还不错. 原来12M的pdf文件, 压完了不超过3M. yum install ghostscript An interpreter for the PostScript language and for PDF. 2. compress-pdf https://github.com/jbenet/compress-pdf.git 挺简单的. 方便操作. compress-pdf filename outfilename 来源: https://my.oschina.net/joryqiao/blog/3112012

Ghostscript grayscale conversion still contains colors?

萝らか妹 提交于 2019-11-30 14:17:45
问题 I need to convert a pdf in grayscale if it does contain colors. For this purpose i found a script which can determine if the pdf is already in grayscale or not. convert "source.pdf" -colorspace RGB -unique-colors txt:- 2> /dev/null \ | egrep -m 2 -v "#([0-9|A-F][0-9|A-F])\1{3}" \ | wc -l This counts how many colors with different values of RGB (so they are not gray) are present in the document. If the pdf is not already a grayscale document i proceed with the conversion with ghostscript gs \

Ghostscript grayscale conversion still contains colors?

老子叫甜甜 提交于 2019-11-30 10:06:34
I need to convert a pdf in grayscale if it does contain colors. For this purpose i found a script which can determine if the pdf is already in grayscale or not. convert "source.pdf" -colorspace RGB -unique-colors txt:- 2> /dev/null \ | egrep -m 2 -v "#([0-9|A-F][0-9|A-F])\1{3}" \ | wc -l This counts how many colors with different values of RGB (so they are not gray) are present in the document. If the pdf is not already a grayscale document i proceed with the conversion with ghostscript gs \ -sOutputFile=temp.pdf \ -sDEVICE=pdfwrite \ -sColorConversionStrategy=Gray \ -dProcessColorModel=

How to make Ghostscript's `ps2pdf14` stop subsetting fonts

做~自己de王妃 提交于 2019-11-30 09:58:19
I am using the ps2pdf14 utility that ships with Ghostscript, and I am having a problem with fonts. It does not seem to matter what instructions I pass to the command, it insists on subsetting any fonts it finds in the source document. e.g -dPDFSETTINGS#/prepress -dEmbedAllFonts#true -dSubsetFonts#false -dMaxSubsetPct#0 Note that the # is because the command is running on Windows, it is the same as =. If anyone has any idea how to tell ps2pdf not to subset fonts, I would be very grateful. --------------------------Notes ------------------------------------------ The source file is a PDF