views:

829

answers:

4

Hi all,

We have a PDF that is generated as A5 landscape pages. With that, we need to do a PDF with A4 portrait page format, by putting 2 pages of the source PDF on top of each other on each page of the result PDF.

Do you know a good library that could do that kind of PDF manipulations ? This should happen server side from an ASP.NET web application, with as little to deploy on the server as possible.

A: 

In the past I've used the PDF Toolkit (GPL). I think it can do what you ask about.

PEZ
A: 

psutils has a utility called psnup that will do this to a Postscript file. You can dump the PDF out to postscript using any of several methods (e.g. pdf2ps), run psnup over it and convert back to PDF using ps2pdf or Distiller.

ConcernedOfTunbridgeWells
+1  A: 

For completeness, I'll add that PDFjam is more direct than going through Postscript and psnup. It includes "pdfnup", which can probably do what you want. But there are a couple of downsides for your application:

  • It's basically just a wrapper for pdfTeX and the package "pdfpages"

  • The scripts are mainly written for Unix-like systems, and only talk about working on Windows through cygwin

The combination of a TeX installation with cygwin doesn't exactly meet your specification of "as little to deploy on the server as possible".

But if you're looking for an open-source solution, pdf(La)TeX really excels at this sort of pdf manipulation. The best route might be to look at what pdfnup does, and duplicate the functionality you need in .NET.

Tom
A: 

Combining two A5 pages into one A4 page should be exactly the same as combining two A4 pages into one A3 page (except for scale), and that problem was answered here two weeks after this question were asked.

hlovdal