ghostscript

Scale pdf to add border for printing full size pages

狂风中的少年 提交于 2019-12-03 15:23:08
When printing a pdf with no border (or margins), the printer choppes off around 1mm of the image data at the edges of the paper. I am therefore looking for a solution to scale/resize a pdf page slightly on the page to add a white border at the edges that will correspond with the white space at the edges produced by the printer. I have tried using gs so far.. For instance, suppose i have an A4 size pdf 1.pdf , then I used: gs -sDEVICE=pdfwrite \ -q -dBATCH -dNOPAUSE \ -dPDFFitPage \ -r300x300 \ -g2232x3157 \ -sOutputFile=1A.pdf \ 1.pdf Here, a full a4 paper is given by -g2480x3508 and I have

ghostscript之pdf处理

女生的网名这么多〃 提交于 2019-12-03 14:51:11
ghostscript安装:   yum install ghostscript 使用: #把tmp目录下的a.pdf压缩成b.pdf gs -sDEVICE=pdfwrite -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH -dQUIET -sOutputFile=/tmp/b.pdf /tmp/a.pdf # -r204x196 -g1728x2292 参数等同于 -sPAPERSIZE=a4 可不加默认 gs -q -r204x196 -g1728x2292 -sDEVICE=pdfwrite -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH -dQUIET -sOutputFile=/tmp/b.pdf /tmp/a.pdf   #把pdf转化为图片 图片为a1.png a2.png a3.png .... gs -dQUIET -dNOSAFER -dBATCH -sDEVICE=pngalpha -dNOPAUSE -dNOPROMPT -sOutputFile=/tmp/a%d.png /tmp/a.pdf 参数说明: -sDEVICE=pdfwrite 表示输出格式为pdf -dPDFSETTINGS -dPDFSETTINGS=/screen质量较低,体积较小。 -dPDFSETTINGS=

Prevent Ghostscript from writing errors to standard output

偶尔善良 提交于 2019-12-03 14:44:22
I'm using Ghostscript to rasterize the first page of a PDF file to JPEG. To avoid creating tempfiles, the PDF data is piped into Ghoscripts's stdin and the JPEG is "drained" on stdout. This pipeline works like a charm until GS receives invalid PDF data: Instead of reporting all error messages on stderr as I would have expected, it still writes some of the messages to stdout instead. To reproduce: $ echo "Not a PDF" >test.txt $ /usr/bin/gs -q -sDEVICE=jpeg -dBATCH -dNOPAUSE -dFirstPage=1 -dLastPage=1 \ -r300 -sOutputFile=- - < test.txt 2>/dev/null Error: /undefined in Not Operand stack:

Changing the text and background color of a PDF file

本小妞迷上赌 提交于 2019-12-03 13:57:58
I'd like to change the background color and text color programmatically in PDF documents so that they're nicer to read at night (kinda like in Adobe Reader: Edit -> Preferences -> Accessibility -> Replace Document Colors ). Is there any good command line tool or API for Windows that can do that? So far I haven't found any. It's OK if it needs to save the newly colored PDF into a new file. There is no way to do this directly, with no (Free Software or gratis) tool I'm aware of. (Because in the general case, you'll have to change all colors of the PDF pages, not just the background alone, so you

Handling (remapping) missing/problematic (CID/CJK) fonts in PDF with ghostscript?

混江龙づ霸主 提交于 2019-12-03 13:18:56
问题 In brief, I'm dealing with a problematic PDF, which: Cannot be fully rendered in a document viewer like evince , because of missing font information; However - ghostscript can fully render the same PDF. Thus -- regardless of what ghostscript uses to fill in the blanks ( maybe fallback glyphs, or a different method to accessing fonts ) -- I'd like to be able to use ghostscript to produce ("distill") an output PDF, where pretty much nothing will be changed, except font information added, so

Tools to convert multipage PDF to multipage TIFF [closed]

て烟熏妆下的殇ゞ 提交于 2019-12-03 09:53:33
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I'm writing a small application to convert several multipage PDF's to multipage TIFF files. Per the other questions and answers on this site, I've tried both ghostscript and ImageMagick however both pieces of software only covert the first page when I run them. Are there any other tools I can use to accomplish

Ghostscript postscript pswrite is encoding text

匿名 (未验证) 提交于 2019-12-03 09:52:54
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Why is Ghostscript pswrite encoding my text in its output? Consider the following MWE: %!PS-Adobe-3.0 %%Title: mwe.ps %%Pages: 001 %%BoundingBox: 0 0 595 842 %%EndComments %%Page: 1 1 %%PageBoundingBox: 0 0 595 842 0 0 1 setrgbcolor 0 0 595 842 rectfill 1 0 0 setrgbcolor 247 371 100 100 rectfill /Times-Roman findfont 72 scalefont setfont newpath 247 300 moveto (Chris) show showpage Saving this MWE to file and viewing in GSview will display a blue page with red square and my name underneath. Now run this file through Ghostscript 9.06 with the

Ghostscript convert PDF to JPG (CMYK profile) resolution error

匿名 (未验证) 提交于 2019-12-03 09:14:57
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using Ghostcript to convert some PDF files to JPG. All is working when converting the program consider the resolution of 600dpi when converting and output jpeg quality is good. Here is my code : gs -sDEVICE=jpegcmyk -dTextAlphaBits=4 -r600 -dSAFER -dBATCH -dNOPAUSE -o my_output_file.jpg my_input_file.pdf But when I open the file in Photoshop, the properties contains 72dpi instead of 600dpi I expected : When I try with RGB profile for output, it is ok, I have got 600dpi. So what I want is CMYK + 600dpi in image properties. 回答1: As can be

How do I send a PDF in a MemoryStream to the printer in .Net?

匿名 (未验证) 提交于 2019-12-03 09:05:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a PDF created in memory using iTextSharp and contained in a MemoryStream. I now need to translate that MemoryStream PDF into something the printer understands. I've used Report Server in the past to render the pages to the printer format but I cant use it for this project. Is there a native .Net way of doing this? For example, GhostScript would be OK if it was a .Net assembly but I don't want to bundle any non .Net stuff along with my installer. The PrintDocument class in .Net is great for sending content to the printer but I still

GhostScript Error

匿名 (未验证) 提交于 2019-12-03 08:56:10
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: On a particular PDF, when running the following command: gs -dSAFER -dBATCH -dNOPAUSE -dQUIET -dFirstPage=1 -dLastPage=1 -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf I get this error: GPL Ghostscript 8.71: Warning: 'loca' length 188 is greater than numGlyphs 93 in the font MGOXZX+Arial-BoldMT. Any ideas what this error means and how to resolve the issue? 回答1: First, Ghostscript didn't declare this as an 'error', but a 'warning'. That's quite a difference. Second, you asked Ghostscript to output the first page of a PDF input. Did it