Hi,
Besides changing the rotation of the page I would like to change the size of the page also. Say if originating file is having A3 size pages then destination file should have A4 size pages having content of a single origin page on multiple destination pages.
Thanks,
Vinod
Miguel Uribe <iscjunior <at> yahoo.com> writes:
>
> Hi,
>
> I need to copy one page from a document to another, the original file has the page I need
> to copy (page 6) in portrait orientation but I need it in landscape.
>
> If I create the new document with landscape orientation and also use
> cb.addTemplate(page1, 1, 0, 0, 1, 0, 0); the new file has the page in
landscape but the content is portrait since that's the way it is in the original file.
>
> How can I have the copy.pdf file with both page and content in landscape orientation? If
> I use the add method I only get a rectangle in the new file rather than the whole
> content. Is it possible to copy the page AS IS and after that rotate the page so it is in
> landscape orientation?
>
> This is my code:
>
> PdfReader reader = new PdfReader("C:\\test.pdf");
> Document document = new Document(PageSize.A4.rotate()); //new doc in landscape
> PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream("C:\\copy.pdf"));
>
> document.open
();
> PdfContentByte cb = writer.getDirectContent();
> document.newPage();
>
> PdfImportedPage page1 = writer.getImportedPage(reader,6);
> cb.addTemplate(page1, 1, 0, 0, 1, 0, 0);
> //cb.add(page1);
> cb.beginText();
> cb.endText();
> document.close();
>
> Thanks in advance.
> Miguel
- [iText-questions] Re: Copying one page from a document to an... Vinod Singh
