Nice, that is exactly what I was looking for. I updated my code and the 340 page doc went from 24MB down to about 500K. My only issue now is that I am still writing each page to a temp file and I would prefer to handle this all in memory. I found some Java examples that used a ByteArrayOutputStream for the stamper. Any idea what the corresponding procedure would be for C#?
Steve Paulo Soares wrote: > > Append the page using PdfSmartCopy. > > Paulo > >> -----Original Message----- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On >> Behalf Of sanderson >> Sent: Friday, May 11, 2007 5:30 PM >> To: [email protected] >> Subject: [iText-questions] Duplicate Font Problem (itextsharp) >> >> >> I'm setting up an app to print tickets using PDF forms. >> Sometimes we have a >> need to print over 1000 tickets, so I use a stamper to fill a >> form, then >> append the page to another master document. The problem is >> that each page >> has fonts embedded in them and the filesize gets huge. I >> reaved a 21MB pdf >> in Acrobat Professional and it brought it down to 1.5MB, so >> there is a ton >> of wasted space. Is there a better way to handle this so >> that the fonts >> only get embedded once? >> >> foreach (RequestDetail detail in details) >> { >> // PrintPaperPass uses the stamper to create the >> completed temp >> pdf file and flatten it >> detail.PrintPaperPass(Server.MapPath(formFile), >> Server.MapPath(tempFile)); >> >> PdfReader readerTemp = new >> PdfReader(Server.MapPath(tempFile)); >> PdfContentByte cb = writer.DirectContent; >> document.NewPage(); >> PdfImportedPage page = >> writer.GetImportedPage(readerTemp, 1); >> cb.AddTemplate(page, 0, 0); >> } > > > Aviso Legal: > Esta mensagem é destinada exclusivamente ao destinatário. Pode conter > informação confidencial ou legalmente protegida. A incorrecta transmissão > desta mensagem não significa a perca de confidencialidade. Se esta > mensagem for recebida por engano, por favor envie-a de volta para o > remetente e apague-a do seu sistema de imediato. É proibido a qualquer > pessoa que não o destinatário de usar, revelar ou distribuir qualquer > parte desta mensagem. > > Disclaimer: > This message is destined exclusively to the intended receiver. It may > contain confidential or legally protected information. The incorrect > transmission of this message does not mean the loss of its > confidentiality. If this message is received by mistake, please send it > back to the sender and delete it from your system immediately. It is > forbidden to any person who is not the intended receiver to use, > distribute or copy any part of this message. > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > Buy the iText book: http://itext.ugent.be/itext-in-action/ > > -- View this message in context: http://www.nabble.com/Duplicate-Font-Problem-%28itextsharp%29-tf3728362.html#a10631877 Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
