Cropping a PDF using Ghostscript 9.01

First, take note that the measurement unit for PDF is the same as for PostScript: it’s called a point [pt]. 72 points == 1 inch == 25.4 millimeters Assuming you have a page size of A4. Then the media dimensions are: 595 points width == 210 millimeters 842 points height == 297 millimeters Assuming you … Read more

What “thread safe” really means…In Practical terms

A precise technical definition that everyone agrees on is difficult to come up with. Informally, “thread safe” simply means “is reasonably well-behaved when called from multiple threads”. The object will not crash or produce crazy results when called from multiple threads. The question you actually need to get answered if you intend to do multi-threaded … Read more

Resizing a PDF using Ghostscript

You should add the -dFIXEDMEDIA switch: gs \ -o output.pdf \ -sDEVICE=pdfwrite \ -sPAPERSIZE=a4 \ -dFIXEDMEDIA \ -dPDFFitPage \ -dCompatibilityLevel=1.4 \ input.pdf -dFIXEDMEDIA is always required if you need to force a specific paper/page/media size and ignore the paper/page/media size specified in the document. Because PDF always has a paper/page/media size defined (PostScript might have, … Read more

Ghostscript to merge PDFs compresses the result

Here’s some additional options that you can pass when using pdfwrite as your device. According to that page if you don’t pass anything then -dPDFSETTINGS it gets set to something close to /screen, although it doesn’t get more specific. You could try setting it to -dPDFSETTINGS=/prepress which should only compress things above 300 dpi. gs … Read more

Converting a PDF to PNG

You can use one commandline with two commands (gs, convert) connected through a pipe, if the first command can write its output to stdout, and if the second one can read its input from stdin. Luckily, gs can write to stdout (… -o %stdout …). Luckily, convert can read from stdin (convert -background transparent – … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)