ghostscript

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

梦想与她 提交于 2019-12-19 03:07:44
问题 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

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

丶灬走出姿态 提交于 2019-12-19 02:52:05
问题 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

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

怎甘沉沦 提交于 2019-12-18 18:25:16
问题 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

Convert PDF to JPG / Images without using a specific C# Library [closed]

老子叫甜甜 提交于 2019-12-18 11:53:56
问题 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 5 years ago . is there a free C# library ( .dll ) to convert PDF to images ? I tried this one : https://code.google.com/p/lib-pdf/ But it doesn't work, I got this error : Could not load file or assembly 'libpdf.DLL' or one of its dependencies. The specified module could not be found. iTextSharp doesn't implement a function

Converting a multi page pdf to multiple pages using a single command

筅森魡賤 提交于 2019-12-18 11:42:19
问题 I want to convert multi page pdfs into single page images efficiently. I already know how to do this one page at a time with imagemagick. For example, convert x.pdf[2] x3.jpg will give me the 3rd page of the pdf as an image. So if I figure out how many pages are in the pdf using identify then I can loop through and convert all pages in the pdf to images. This method can however take a while. For example a 15 page pdf could take anywhere between 15-30 seconds. According to answers that I have

How to crop a section of a PDF file to PNG using Ghostscript

风流意气都作罢 提交于 2019-12-18 11:36:27
问题 I need to crop a certain section in my PDF file to PNG (this will be automated using Ghostscript with PHP). This is what i do now which basically turns the first page of a PDF to PNG: gs -q -dNOPAUSE -dBATCH \ -sDEVICE=pngalpha -dEPSCrop \ -sOutputFile=output.png input.pdf Specifically, i'm trying to crop this top left card to a PNG. I'm also open for more suggestions on how to accomplish this. 回答1: First, determine the bounding box of your first PDF page: gs \ -q \ -dBATCH \ -dNOPAUSE \

Stamp PDF file with control for position of stamp file

别等时光非礼了梦想. 提交于 2019-12-18 11:13:27
问题 Does anyone know about stamping PDF file to PDF file and also controls for positioning PDF file stamp? I have a file orginal.pdf and logo.pdf . I want to stamp logo.pdf file to file orginal.pdf at the top left of file original.pdf . How can it be done with Ghostscript or pdftk ? 回答1: It can be done with Ghostscript plus pdftk, but it requires at least 2 different steps. AFAIK, you cannot directly control pdftk 's stamp placement. By default it puts the stamp on the center of the page, and at

Ghostscript color detection

强颜欢笑 提交于 2019-12-18 10:46:16
问题 I seem to be unable to find whether Ghostscript is able to simply detect whether job is color or grayscale. I use Ghostscript for conversion of print jobs to PNG, but I also need to have information about color of the job, so I don't have to search it pixel by pixel again. 回答1: A (relatively new) Ghostscript device called inkcov (you need Ghostscript v9.05 or newer) can reliably detect whether a PDF page uses color or not. It displays the ink coverage for the CMYK inks, separately for each

PDF compare on linux command line

烈酒焚心 提交于 2019-12-18 10:12:02
问题 I'm looking for a Linux command line tool to compare two PDF files and save the diffs to a PDF outfile. The tool should create diff-pdf's in a batch-process. The PDF files are construction plans, so pure text-compare doesn't work. Something like: <tool> file1.pdf file2.pdf -o diff-out.pdf Most of the tools I found convert the PDFs to images and compare them, but only with a GUI. Any other solution is also welcome. 回答1: I've written my own script that does something similar to what you're

Cropping a PDF / Adding crop box using Ghostscript

大憨熊 提交于 2019-12-18 03:37:08
问题 I have a few hundred PDFs that I need to crop - I'm willing to either crop the actual documents or simply add a crop box to each so the correct viewable area shows when the PDF is opened. How can I do this using Ghostscript (v8.71)? I found this: gs -sDEVICE=pdfwrite -sOutputFile=marked.pdf [/CropBox [54 54 1314 810] /PAGES pdfmark original.pdf I've tried this (and all variants I can think of) but I always get an error such as this: Error: /undefinedfilename in ([/CropBox) I've tried moving