itext-questions-ow...@lists.sourceforge.net wrote:
> Why I have to rotate and rescale is, because some pages of a source 
> document have to be converted from A4 to A5 and put in one page 
> (2in1), while others shall remain untouched. Maybe there is already a 
> helper which does this task but I've overseen it.
Aha, that makes sense. That's probably what you meant by weaving.
You weren't talking about "superimposing", but about "N-upping".
It's important to use the correct terminology.
> I've claimed that I couldn't copy a page AS-IS, because I did not 
> located API for it, like provided by PdfCopy, so the following works 
> fine for me:
I deleted the code snippet to avoid that other people see it and then 
claim it doesn't work.  
> I believe there is a better way to perform this task, maybe you'd tell 
> me the way you'd go for it? Should I rather use PdfStamper for it?
Why PdfStamper???

Create a Document
use PdfWriter as the writer object
open the document
for each page you want to add {
    use PdfReader to read the page,
    set the page size with document.setPageSize();
    trigger a newPage() with document.newPage();
    add the PdfImportedPage using addTemplate();
}
close the document

If you need to add two pages on one, take a look at the NUp example from 
chapter 6.2.3

(A hurdle you may need to take, is that it may be difficult to set the 
page size of the first page if you're using an old iText version.)
> And finally, if I got right its impossible to work on all levels of 
> the document at same time, since all the PdfWriter, PdfCopy, 
> PdfStamper etc. operate at outputstream level and you cannot mix them 
> on an open stream, can you?
The book has several examples where PdfCopy, PdfSmartCopy and PdfStamper 
are used in a chain.
For instance: small documents are created in memory with PdfStamper 
(using a ByteArrayOutputStream),
and then concatenated using PdfSmartCopy (writing to a FileOutputStream).

------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to