ghostscript

Using GhostScript to get page size

北城以北 提交于 2019-11-27 08:41:12
Is it possible to get the page size (from e.g. a PDF document page) using GhostScript? I have seen the "bbox" device, but it returns the bounding box (it differs per page), not the TrimBox (or CropBox) of the PDF pages. (See http://www.prepressure.com/pdf/basics/page_boxes for info about page boxes.) Any other possibility? Meanwhile I found a different method. This one uses Ghostscript only (just as you required). No need for additional third party utilities. This method uses a little helper program, written in PostScript, shipping with the source code of Ghostscript. Look in the toolbin

PDF - Remove White Margins

廉价感情. 提交于 2019-11-27 08:06:51
I would like to know a way to remove white margins from a PDF file. Just like Adobe Acrobat X Pro does. I understand it will not work with every PDF file. I would guess that the way to do it, is by getting the text margins, then cropping out of that margins. PyPdf is preferred. iText finds text margins based on this code: public void addMarginRectangle(String src, String dest) throws IOException, DocumentException { PdfReader reader = new PdfReader(src); PdfReaderContentParser parser = new PdfReaderContentParser(reader); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(RESULT))

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

戏子无情 提交于 2019-11-27 07:17:14
问题 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). 回答1: 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

How to use ghostscript to convert PDF to PDF/A or PDF/X?

删除回忆录丶 提交于 2019-11-27 06:53:26
Is there a way to use ghostscript to convert PDF to PDF/A or PDF/X? I know it can be used to convert PDF to images, but I don't know if it can be used to convert PDF/A. What parameters should I use? This is to convert a pdf document (not pdf/a) into pdf/a: gs -dPDFA -dBATCH -dNOPAUSE -dUseCIEColor -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -sPDFACompatibilityPolicy=1 -sOutputFile=output_filename.pdf input_filename.pdf Hope this will help some one! @danio, @imgen: Even recently released documentation pages on PDF/X (standardized Prepress requirements) and PDF/A (standardized Archiving

Ghostscript for PDF: how to fit 4 pages into 1?

心不动则不痛 提交于 2019-11-27 04:52:26
问题 I need to use ghostscript for concatenating several PDFs into a single pdf file. The help I need from you is what command do I have to use, in order to edit the output page, so that it fits 4 pages of the input files, into 1 of the output. What I am using so far is this command: gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite \ -sOutputFile=ALL.pdf plot_1.pdf plot_n.pdf Input files are A4 landscape, and the output have to be the same format. Thanks to all, Cristian 回答1: This is a program I wrote

ghostscript: convert PDF into CMYK preserving pure Black for text

霸气de小男生 提交于 2019-11-27 04:39:55
问题 I need to convert RGB PDF into CMYK PDF. I need to have pure black color for texts. It seems (thanks to comments below) term "black point compensation" is wrong. I took it from Adobe Acrobat where it works exactly how i need. I thought gs has same feature. I use ghostscript 9.16 If i got it right there is -dBlackPtComp option, but it does not work for me. Ghostscript command I have tried is: "c:/Program Files/gs/gs9.16/bin/GSWIN64C.EXE" -o testing_black_cmyk.pdf -sColorConversionStrategy=CMYK

is it possible to check if pdf is password protected using ghostscript?

隐身守侯 提交于 2019-11-27 04:38:42
问题 is it possible to check if pdf is password protected using ghostscript? what would be the command? I know you can strip pdf password using ghostscript, but all I want to do is just checking if PDF is password protected or security enabled. 回答1: checkuserpasswdPDF.sh : #!/bin/sh GS=~/gs/bin/gs output=`$GS -dBATCH -sNODISPLAY "$1" 2>&1` gsexit=$? if [ "$gsexit" == "0" ]; then echo "Not user-password protected" exit 0; else found=`echo "$output" |grep -o "This file requires a password"` if [ -z

How can I remove all images from a PDF?

拥有回忆 提交于 2019-11-27 04:07:59
I want to remove all images from a PDF file. The page layouts should not change. All images should be replaced by empty space. How can this be achieved with the help of Ghostscript and the appropriate PostScript code? Meanwhile the latest Ghostscript releases have a much nicer and easier to use method of removing all images from a PDF. The parameter to add to the command line is -dFILTERIMAGE gs -o noimages.pdf -sDEVICE=pdfwrite -dFILTERIMAGE input.pdf Even better, you can also remove all text or all vector drawing elements from a PDF by specifying -dFILTERTEXT or -dFILTERVECTOR . Of course,

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

冷暖自知 提交于 2019-11-27 02:58:44
问题 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 -

How to merge two postscript files together?

筅森魡賤 提交于 2019-11-27 01:59:15
问题 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.