Print PDF document with python’s win32print module?

I ended up using Ghostscript to accomplish this task. There is a command line tool that relies on Ghostscript called gsprint. You don’t even need Acrobat installed to print PDFs in this fashion which is quite nice. Here is an example: on the command line: gsprint -printer \\server\printer “test.pdf” from python: win32api.ShellExecute(0, ‘open’, ‘gsprint.exe’, ‘-printer … Read more

How to merge two postscript files together?

Here is an example Ghostscript commandline, which would convert and merge the two (or more) PostScript files into one PDF in a one go: gswin32c.exe ^ -o c:/path/to/output.pdf ^ -sDEVICE=pdfwrite ^ -dPDFSettings=/Screen ^ […more desired parameters (optional)…] ^ /path/to/first.ps ^ /path/to/second.ps ^ /path/to/third.pdf Edit: my first shot had falsely assumed PDF input files. It works … Read more

overlay one pdf or ps file on top of another

You can do this with pdf files using the command line tool pdftk using the stamp or background option. e.g. $ pdftk file1.pdf background file2.pdf output combinedfile.pdf This will only work with a one-page background file. If you have multiple pages, you can use the multibackground command instead.

How can I remove all images from a PDF?

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 … Read more