In the end I think iText is too high level a library for the kind of manipulations I need.
Hence, today I tried Apache PDFBox. After a couple of hours playing with it, I managed to solve my problem with 18 lines of code. It preserves all contents, including meta-information, optional contents, etc. and rescales the pages as needed. On 2012-04-02 17:31, Michel Onoff wrote: > On 2012-04-02 17:01, 1T3XT BVBA wrote: >> On 2/04/2012 16:21, Michel Onoff wrote: >>> It is unclear, though, how to rescale the pages to >>> fit a fixed page size (A4 in my case). >> It would involve that you change all metrics in the complete PDF. >> You're creating a new tool that will take you several man-months, and >> for what? > > I don't get your point. The examples in the iText book show how easy it > is to combine pages to achieve n-up copying, for instance. And my > current code (the one based on PdfWriter rather than on PdfStamper) does > rescaling without fuss. It's a couple of lines of code. But for the > reasons explained by Leonard I cannot continue to use PdfWriter. > > In the end, I would like to make a copy of a PDF, including optional > content, while slightly rescaling the pages. Am I really asking too much? > >> I don't know of any viewer that isn't able to scale the pages for you. >> What purpose does it serve if the pages are A4? >> We're talking about a vector-based document format! >> > > The problem is that there are many printers around that suspend their > jobs when they get documents that do not fit the physical paper size in > the trays. A queue of dozen A4 documents, for example, can be blocked by > a single Letter document because the printer stops to ask for some user > input. In some environments this is unacceptable. To avoid this, I need > to rescale some PDFs to A4 format before they get to the printers, > without user intervention. > ------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
