Thank you Eric for pointing me on the right direction.

I put couple of hours with the approach you told me and was able to rotate the 
page (270) but now I have it upside down.

But looking for more answers on the web seems to me like I opened a pandora's 
box... people getting angry when talking about that matrix... I'm  even scare 
to ask about it :)

Any ways thank you for your answer.  I think I'll have to go back to my old 
math books... man more that 15 years without touching that!

Thanks.

________________________________________
From: de Beus, Eric [[email protected]]
Sent: Thursday, May 20, 2010 11:06 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Document rotates while merging

Miguel,

Scanners often create rotated pages, because the scanner actually
creates an image with the scan lines running along the long edge
of the sheet, and then rotates the page to compensate. You need
to get the rotation of the pages from the PdfReader, and then
apply that rotation in your call to AddTemplate, using the overloaded
method that takes a transformation matrix.

- Eric

-----Original Message-----
From: RivasAviles, Miguel [mailto:[email protected]]
Sent: Thursday, May 20, 2010 8:44 AM
To: '[email protected]'
Subject: [iText-questions] Document rotates while merging

Hello,

I'm merging some pdf files using PdfReader but for some reason documents
that contains images (created from scanned documents) just rotates.
Please see attachments.

I'm using a simple merging process.  Any Idea on what am I doing wrong?

foreach (PdfReader pdfReader in readers) {
        // Create a new page in the target for each source page.
        while (pageOfCurrentReaderPDF < pdfReader.NumberOfPages)
        {
                document.NewPage();
                pageOfCurrentReaderPDF++;
                currentPageNumber++;
                page = writer.GetImportedPage(pdfReader,
pageOfCurrentReaderPDF);
                cb.AddTemplate(page, 0, 0);

                // Code for pagination.
                if (paginate)
                {
                        cb.BeginText();
                        cb.SetFontAndSize(bf, 9);
                        cb.ShowTextAligned(PdfContentByte.ALIGN_CENTER,
string.Format("{0} of {1}", currentPageNumber, totalPages), 520, 5, 0);
                        cb.EndText();
                }

                // Confidential notice
                cb.BeginText();
                cb.SetFontAndSize(bf, 30);
                cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT,
"CONFIDENTIAL", 600, 300, 90);
                cb.EndText();

        }
      pageOfCurrentReaderPDF = 0;
}




Thank you.

Miguel


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

_______________________________________________
iText-questions mailing list
[email protected]
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/
------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
[email protected]
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