Any updates?

-----Original Message-----
From: Tandon, Amrish 
Sent: Thursday, January 18, 2007 12:03 PM
To: 'Post all your questions about iText here'
Subject: RE: [iText-questions] (no subject)

Let me clarify.

The PdfCopyFields and PdfStamper are working fine. It is everything after the 
PdfStamper that is using the document to add pages and the header/footer that 
is not doing anything.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paulo Soares
Sent: Thursday, January 18, 2007 11:52 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] (no subject)

You have to reinitialize baos before using it in PdfStamper, it was closed in 
PdfCopyFields.

Paulo 

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Tandon, Amrish
> Sent: Thursday, January 18, 2007 4:15 PM
> To: itext-questions@lists.sourceforge.net
> Subject: [iText-questions] (no subject)
> 
> Hello all. 
> 
> I need help! I am trying to use iText to build a PDF composed of 
> several other PDFs.and then add some dynamic content.  The code below 
> is what I have so far. It does not seem to take the page additions and 
> the header and footers.
> 
> 
>                 protected void doPost(HttpServletRequest request, 
> HttpServletResponse response) throws ServletException, IOException
> 
>         {
>                 
>                 try {
>                         
>                         
>                         ByteArrayOutputStream baos = new 
> ByteArrayOutputStream();
>                         
>                         //concatinate documents
>                         
>                         PdfCopyFields copy = new PdfCopyFields(baos); 
>                         copy.addDocument(new 
> PdfReader("c:\\coverpage.pdf"));
>                         copy.addDocument(new 
> PdfReader("c:\\BO_INTRO.pdf"));
>                         copy.close();
>                         
>                         //Update form field(s)
>                         
>                         PdfReader reader = new 
> PdfReader(baos.toByteArray());
>                         PdfStamper stamper = new 
> PdfStamper(reader,baos);
>                         AcroFields form = stamper.getAcroFields(); 
>                         form.setField("groupName", "My Group"); 
>                         stamper.setFormFlattening(true); 
>                         stamper.close();
>                         
>                         reader = new 
> PdfReader(baos.toByteArray());     
>                         
>                         //Add dynamic content. 
>                         
>                         Document document = new 
> Document(reader.getPageSizeWithRotation(1));
>                         document.open();
>                 
>                         document.newPage(); 
>                         document.add(new Paragraph("Hello World")); 
>                         document.add(new Paragraph(new 
> Date().toString()));
>                         document.newPage(); 
>                         document.add(new Paragraph("Hello World 
> Again"));
>                         document.add(new Paragraph(new 
> Date().toString()));
>                         
>                         //Add header and footer 
>                         document.setHeader(new HeaderFooter(new 
> Phrase("This is a header"),false));
>                         document.setFooter(new HeaderFooter(new 
> Phrase("This is a footer"),true));
>                         document.close();
>                         
>                         response.setHeader("Expires", "0"); 
>                         response.setHeader("Cache-Control",
> "must-revalidate, post-check=0, pre-check=0"); 
>                         response.setHeader("Pragma", "public"); 
>                         response.setContentType("application/pdf"); 
>                         response.setContentLength(baos.size()); 
>                         ServletOutputStream out = 
> response.getOutputStream();
>                         baos.writeTo(out); 
>                         out.flush(); 
>                 } catch (DocumentException e) { 
>                         e.printStackTrace(); 
>                 }
>                 
>                 
>                 
>                 
>         }
> 
> 
> Blue Cross Blue Shield of Florida, Inc., and its subsidiary and 
> affiliate companies are not responsible for errors or omissions in 
> this e-mail message. Any personal comments made in this e-mail do not 
> reflect the views of Blue Cross Blue Shield of Florida, Inc.  The 
> information contained in this document may be confidential and 
> intended solely for the use of the individual or entity to whom it is 
> addressed.  This document may contain material that is privileged or 
> protected from disclosure under applicable law.  If you are not the 
> intended recipient or the individual responsible for delivering to the 
> intended recipient, please (1) be advised that any use, dissemination, 
> forwarding, or copying of this document IS STRICTLY PROHIBITED; and
> (2) notify sender immediately by telephone and destroy the document. 
> THANK YOU.
> 
> 


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.




Blue Cross Blue Shield of Florida, Inc., and its subsidiary and affiliate 
companies are not responsible for errors or omissions in this e-mail message. 
Any personal comments made in this e-mail do not reflect the views of Blue 
Cross Blue Shield of Florida, Inc.  The information contained in this document 
may be confidential and intended solely for the use of the individual or entity 
to whom it is addressed.  This document may contain material that is privileged 
or protected from disclosure under applicable law.  If you are not the intended 
recipient or the individual responsible for delivering to the intended 
recipient, please (1) be advised that any use, dissemination, forwarding, or 
copying of this document IS STRICTLY PROHIBITED; and (2) notify sender 
immediately by telephone and destroy the document. THANK YOU.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to