ghostscript

How to change page orientation of PDF? (GhostScript or PostsScript solution needed)

Given a PDF document, how do I change individual page orientation? I'm using latest version of GhostScript. ...

phpThumb PDF thumbnail

Hi, I am using phpThumb to create thumbnails of PDFs uploaded to my site. This is working for some PDFs but others produce an error that states imagemagick and or ghostscript are unavailable. These should be available as phpThumb is using these for the working PDF thumbnails. One thing that I have noticed is that it tends to be PDFs ...

PDF convert with ImageMagick and Ghostscript on Windows Vista/7 x64

Hello all, I've just spent the last three hours getting ImageMagick to play nicely with PHP for a PDF to JPG convert. Instead of documenting it myself locally, I figured I'd write it up here, with all the buzzwords and things I screwed up, so the next noob can save some time. Tested on two OSs,Windows 7 x64 and Vista x64, with PHP 5....

Prevent Ghostscript from writing errors to standard output

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 ...

Ghostscript converting Postscript to PNG is over-saturated

I'm trying to use Ghostscript and/or ImageMagick to convert each page of a Postscript document into PNG images. The problem is that both produce images that are way too saturated (I think that's the right terminology). Here are the commands I'm trying: gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dGraphicsAlphaBits=4 -sOutputFile=page...

Fine-tuning ghostscript PDF to PS conversion

I have a program that generates a PDF as output. If I send this file to a printer using the Adobe viewer, it prints exactly as wanted. In particular, the application is printing labels and there's a requirement that every last pixel on the page is used, i.e. no margins whatsoever. I'd like to try and automate this process. GhostScript s...

Can't add new Redirected Port in Windows 7 after installing RedMon

My operating system is Windows 7 32bit. I installed RedMon1.7, Ghostscript 8.71 and GSview 4.9; installations were successful. I went to Add New Local Printer in Windows Devices and Printers, clicked on Create A New Port, and selected Redirected Port from the Type of Port list. Clicked Next and in the Add New Port window I named RPT1: an...

Where can I find resources on developing a PostScript printer for Windows 7

I'm developing a virtual printer to accept print jobs and route them to real printers in a LAN. I'm hoping to create a postscript printer to act as a shared virtual printer to accept print jobs from the LAN, I hope to develop it through ghostscript and redmon. If you can please let me know any online resources, examples or any tutorials...

How to merge two postscript files together?

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 ...

I want my Ghostscript to output PNG pagenames starting with a higher number, e.g. "31". How?

Using Ghostscript I want to create ~330 PNG files from a PDF (photobook I was given as a gift). Now I want to put these pictures online. I'm aware of the method to use -sOutputFile=somename--%03d.png which will give me numbered PNG filenames along the pattern somename--001.png, somename--002.png, etc. However, I want to put ~25-30 more ...

How can I shift page images in PDF files more to the left or to the right?

We have a bunch of scanned pages (about 600) for which every PDF viewer displays the image with zero margin on the right edge, but about 2 inch margin on the left. (Presumably while scanning, there was a wrong setting used...) We want to print these pages, preferably as a booklet. Is there a way to permanently shift all page images tow...

What parameters will allow Ghostscript to read font names in Chinese correctly from a PDF?

I tried gswin32c -sDEVICE=jpeg -sOutputFile=foo.jpg foo.pdf but I get the ff. output from Ghostscript on the page where the Chinese font is used. Substituting CID font resource/Adobe-CNS1 for /·s²Ó©úÅé. Error: /undefinedresource in --findresource-- Operand stack: --dict:4/4(L)-- F3 12.96 --dict:6/6(L)-- --dict:6/6(L)-- ·...

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

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 b...

Ghostscript renders embedded fonts in pdf poorly (all jaggy)

Hi, Ghostscript doesn't render embedded fonts in pdf's properly. e.g. http://vegro.nl/cmsfiles/ConsumentenAssortiment/Brochure/10.axd The characters of the logo on the right top ('Thermrad') are all jagged. If I open the file in Adobe Reader, no problem at all! Do you have this problem too? Is there any solution? I've been searching fo...

Ghostscript debug output when using Imagemagick

I'm trying to convert a PDF file to a PNG file using PHP and ImageMagick, the small testcase looks like this: echo exec('/usr/bin/convert test.pdf test.png'); When I'm running this from the command line (php5 pdftest.php) it works just fine, however, when I'm running the request from the webserver, the script echos Last OS error: 12, t...

PDF fonts not visible properly

Hi,I am using ghostscript 8.63 to split the pdf document as individual pages. Problem is for some pdf's in the splitted pdf document fonts are overlapped (black patches). observed for verdana-bold fonts text. I copied all the fonts required for gostscript to -sFontPath directory, and ghostscript also opening the verdana, verdana-bold fo...

What are best parameters to run ImageMagick to convert low quality pdf to images (for OCR)

Hi, I have several low quality pdfs. I would like to use OCR -- to be more precise Ocropus to get text from them. To do use, I use first ImageMagick -- a command line tool to convert pdf to images -- to transforms these pdfs into jpg or png. However ImageMagick produces very low quality images and Ocropus hardly recognizes anything....

Ghostscript not extracting all the text from pdf file

Hi, I am using ghostscript 8.71 to extract text from the pdf pages. The command i am using is gswin32c -q -sFONTPATH=c:\fonts -dNODISPLAY -dSAFER -dDELAYBIND -dWRITESYSTEMDICT -dSIMPLE -fps2ascii.ps -dFirstPage=1 -dLastPage=1 input.pdf -dQUIET. And using stdout writing text to another file. But problem is some searchable text are not e...

How to determine string height in PostScript?

I need to determine the height of a string (in given scale and font) in postscript. /Helvetic-Oblique findfont 10 scalefont setfont 10 10 1 0 360 arc fill 10 10 moveto (test) dup stringwidth pop 2 div neg 0 rmoveto show will print test centered horizontally (but not yet vertically) at (10,10). (to see this, I also show a small circle...

How can you find a problem with a programmatically generated PDF?

My group has been using the itext-sharp library and C#/.NET to generate custom, dynamic PDFs. For the most part, this process is working great for our needs. The one problem we can run into during development/testing is layout issues which can cause the PDF to not open/render correctly in Adobe Reader, esp. the newer versions of Acrobat/...