I am using iText within a Dot Net environment to take a multi-page document
and split it into multiple documents. 20 page original, I need 20 one page
PDFs.
This works like a charm EXCEPT sometimes the individual one page PDFs show
that error message about "An error exists on this page. Acrobat may not
display the page Correctly.".
Any ideas? Given an initial PDF file that exhibts the problem, it is 100%
reproducable on more than one desktop.
private void Split()
{
PdfReader reader = new PdfReader( @"c:\work\ToBeSplit.pdf");
Int32 pageCount = reader.NumberOfPages;
string newFileName = string.Empty;
for (int i = 0; i < pageCount; i++)
{
newFileName = @"c:\work\SplitPart" + i.ToString() + ".pdf";
PdfImportedPage page;
Document document = new Document(PageSize.A4, 0, 0, 0, 0);
PdfWriter writer = PdfWriter.GetInstance(document, new
FileStream(newFileName, FileMode.Create));
document.Open();
PdfContentByte cb = writer.DirectContent;
document.NewPage();
document.SetPageSize(reader.GetPageSizeWithRotation(i + 1));
page = writer.GetImportedPage(reader, i + 1);
cb.AddTemplate(page, 1f, 0, 0, 1f, 0, 0);
document.Close();
Application.DoEvents();
}
}
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Corrupted-Output-spliting-files-tp3934576p3934576.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-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