Hello all, I'm reading a big pdf file, reading a tag inside each pages and creating a new pdf file by copying the current page to it. My problem is that I manage to copy one page to my new pdf but not more than one, if I reopen my newly created pdf in order to add a new page to it, it in facts overwrite it (worst when I open the pdf in acrobat it rebuild it ?). I have to close the document because I'm in fact in a loop and I split my big pdf into several smaller files depending of the data of each pages. Anyone can tell me what I'm doing wrong ?
Here the code I'm using (c#): PdfReader pReader; Document document; PdfWriter writer; PdfContentByte cb; PdfImportedPage page; pReader = new PdfReader(@"c:\temp\detrem.pdf"); document = new Document(pReader.GetPageSizeWithRotation(1)); writer = PdfWriter.GetInstance(document, new FileStream(@"c:\temp\test.pdf", FileMode.OpenOrCreate)); document.Open(); document.NewPage(); cb = writer.DirectContent; page = writer.GetImportedPage(pReader, 1); cb.AddTemplate(page, 0, 0); document.Close(); //... loop... ok found that page 3 has to be added to the same test.pdf document = new Document(pReader.GetPageSizeWithRotation(3)); writer = PdfWriter.GetInstance(document, new FileStream(@"c:\temp\test.pdf", FileMode.OpenOrCreate)); document.Open(); document.NewPage(); cb = writer.DirectContent; page = writer.GetImportedPage(pReader, 3); cb.AddTemplate(page, 0, 0); document.Close(); pReader.Close(); Thanks a lot, Fabio (Belgium) __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
