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/

Reply via email to