Peter Fox
Peter Fox

Reputation:

Best way to change pagination of existing PDF

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.

Upvotes: 2

Views: 5416

Answers (4)

hlovdal
hlovdal

Reputation: 28248

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.

Upvotes: 0

Tom
Tom

Reputation: 1339

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.

Upvotes: 1

ConcernedOfTunbridgeWells
ConcernedOfTunbridgeWells

Reputation: 66692

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.

Upvotes: 0

PEZ
PEZ

Reputation: 17004

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

Upvotes: 0

Related Questions