ghostscript

Any tips for speeding up GhostScript?

馋奶兔 提交于 2019-12-17 21:53:33
问题 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

How do I embed fonts in an existing PDF?

六眼飞鱼酱① 提交于 2019-12-17 15:47:18
问题 Background: I have PDF's I am programmatically generating. I need to be able to send the PDF directly to a printer from the server (not through an intermediate application). At the moment I can do all of the above (generate PDF, send to printer), but because the fonts aren't embedded in the PDF the printer is doing font substitution. Why the fonts aren't embedded when generated: I am creating PDF's using SQL Reporting Services 2008. There is a known issue with SQL Reporting Services in that

Optimize PDF files (with Ghostscript or other)

扶醉桌前 提交于 2019-12-17 15:03:55
问题 Is Ghostscript the best option if you want to optimize a PDF file and reduce the file size? I need to store alot of PDF files and therefore I need to optimize and reduce the file size as much as possible Does anyone have any experience with Ghostscript and/or other? command line exec('gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile='.$file_new.' '.$file); 回答1: If you looking for a Free (as in 'libre') Software, Ghostscript is surely your best

Add comments to PDF files automagically with regular expressions

妖精的绣舞 提交于 2019-12-17 10:37:41
问题 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

How can I extract embedded fonts from a PDF as valid font files?

夙愿已清 提交于 2019-12-17 06:19:35
问题 I'm aware of the pdftk.exe utility that can indicate which fonts are used by a PDF, and wether they are embedded or not. Now the problem: given I had PDF files with embedded fonts -- how can I extract those fonts in a way that they are re-usable as regular font files? Are there (preferably free) tools which can do that? Also: can this be done programmatically with, say, iText? 回答1: You have several options. All these methods work on Linux as well as on Windows or Mac OS X. However, be aware

PDF Text Extraction with Coordinates

房东的猫 提交于 2019-12-17 05:36:40
问题 I would like to extract text from a portion (using coordinates) of PDF using Ghostscript. Can anyone help me out? 回答1: Yes, with Ghostscript, you can extract text from PDFs. But no, it is not the best tool for the job. And no, you cannot do it in "portions" (parts of single pages). What you can do: extract the text of a certain range of pages only. First: Ghostscript's txtwrite output device (not so good) gs \ -dBATCH \ -dNOPAUSE \ -sDEVICE=txtwrite \ -dFirstPage=3 \ -dLastPage=5 \

ghostscript downsampling of pdf images, downsample factor error

回眸只為那壹抹淺笑 提交于 2019-12-14 03:59:02
问题 I issue the following command: gs \ -o downsampled.pdf \ -sDEVICE=pdfwrite \ -dDownsampleColorImages=true \ -dColorImageResolution=180 \ -dColorImageDownsampleThreshold=1.0 \ And get the following errors: Subsample filter does not support non-integer downsample factor (1.994360) Failed to initialise downsample filter, downsampling aborted (on some pages) and: Subsample filter does not support non-integer downsample factor (2.000029) Failed to initialise downsample filter, downsampling aborted

How to convert multiple, different-sized PostScript files to a single PDF?

亡梦爱人 提交于 2019-12-13 21:16:47
问题 I'm using a command similar to this: gswin32c.exe -dNOPAUSE -dBATCH -q -dSAFER -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile="path/output.pdf" <PSfiles> This gives me a single pdf document with each PS document represented as a page. However, the page sizes do not translate well. The original PS files are all different sizes and each resulting pdf page is cutoff to the same size, which looks like landscape A4. When I convert a single PS file with the exact same command, the page size

PDF: How to Optimize Filesize & Convert to PNG (embedded fonts problem)

别来无恙 提交于 2019-12-13 15:47:23
问题 I have a PDF with embedded fonts that I can't seem to work with. Right now, I'm using GhostScript and trying to do 2 things: Minimize filesize of PDF: gswin32c -dSAFER -dBATCH -dNOPAUSE -dQUIET -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf Convert PDF to PNG (super sample, to be used for creating other thumbnails): gswin32c -dSAFER -dBATCH -dNOPAUSE -dQUIET -dFirstPage=1 -dLastPage=1 -r288 -sDEVICE=png16m -sOutputFile=output.pdf input.pdf The above works well when working on scanned

Postscript: watermark with varying page sizes

霸气de小男生 提交于 2019-12-13 06:12:13
问题 I am trying to use postscript to watermark postscript files. I am doing this with setpagedevice like so: << /EndPage { exch pop 2 lt { /Times-Roman 40 selectfont .6 setgray 300 300 moveto 30 rotate (Watermark) show true} {false} ifelse } bind >> setpagedevice (file_to_watermark.ps) run This works great, but I would like the watermark to be centered on the page, regardless of page size (this code needs to work for varying sizes of file_to_watermark.ps). My code right now is positioning the