I can't reproduce the problem. I did:

PdfReader r = new PdfReader("c:\\hihi.pdf");
Image img = Image.getInstance(writer.getImportedPage(r, 1));
img.setAbsolutePosition(0, 0);
doc.add(img);
doc.newPage();

in all the files that you sent and all worked correctly. It may be some freak 
problem from a faulty JVM instalation, I don't know.

Paulo

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Gerold Krommer
> Sent: Monday, September 10, 2007 4:11 PM
> To: Post all your questions about iText here
> Subject: Re: [iText-questions] Is a flattened form special?
> 
> 
> Thanks Paolo,
> 
> This hint didn't fix it. I'm completely baffled about this, 
> especially since I cannot reproduce it with a small 
> self-contained program.
> 
> I tried to look at the final PDF with the toolbox utilites, 
> but my PDF knowledge isn't good enough (I used to be able to 
> read PostScript, albeit somewhat slower than a PS printer).
> 
> What I did now is to stop producing a document after the 
> first, second and last level of my folder hierarch and 
> lo-and-behold somewhat seems to overwrite the previous page!
> 
> If you look at 1stpage.pdf it is correct, if I continue to 
> the next level 2ndpage has a correct 2nd page, but the first 
> is (visually) empty.
> 
> If you look at complete.pdf you see two empty pages, third 
> page from the flattened form is correct and the fourth page 
> is the actual document (converted from a Tiff file).
> 
> I'm not mangling in any way with the output stream, so figure 
> me scratching my head until it hurts.
> 
> Maybe if one of the PDF gods looks at this, he/she can figure 
> out where I was contemplating wrongly.
> 
> Now what an frustrating weekend that was ....
> 
> /DI Gerold Krommer
> Manager Pre- und Postsales
> ASTRON Business Services  G.m.b.H., Vienna, Austria
> Tel.: +43 1 585 31 90-22
> Fax: +43 1 585 31 90-15
>  
> 
> CONFIDENTIAL NOTICE: The contents of this message, including 
> any attachments, are confidential and are intended solely for 
> the use of the person or entity to whom the message was 
> addressed. If you are not the intended recipient of this 
> message, please be advised that any dissemination, 
> distribution, or use of the contents of this message is 
> strictly prohibited. If you received this message in error, 
> please notify the sender. Please also permanently delete all 
> copies of the original message and any attached 
> documentation. Thank you.
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Im 
> Auftrag von Paulo Soares
> Gesendet: Samstag, 08. September 2007 14:53
> An: Post all your questions about iText here
> Betreff: Re: [iText-questions] Is a flattened form special?
> 
> I think I was looking at the wrong place. Try:
> 
>  PdfReader pdfCoverReader = new PdfReader("C:\\hihi.pdf");   
> <-- this is the 
> flattened form
> 
>        PdfImportedPage pip = 
> _pdfWriter.getImportedPage(pdfCoverReader, 1);
> 
>        Image foo = Image.getInstance(pip);
> 
>         foo.setAbsolutePosition(0, 0);
> 
>        _pdfDocument.add(foo);
> 
>        _pdfDocument.newPage();
> 
> 
> Paulo
> 
> ----- Original Message ----- 
> From: "Gerold Krommer" <[EMAIL PROTECTED]>
> To: "Post all your questions about iText here" 
> <[email protected]>
> Sent: Saturday, September 08, 2007 12:58 PM
> Subject: Re: [iText-questions] Is a flattened form special?
> 
> 
> Hi Paolo,
> 
> 
> 
> thanks for looking into this. I have attached the original 
> form from LC 7, 
> the result of the filling and flattening and below is the 
> function that is 
> used for filling, flattening and appending to the document.
> 
> Nevermind my funny namings :-)
> 
> 
> 
> If I have time this weekend I will try to reproduce it with a 
> small code 
> sample.
> 
> 
> 
> Thanks for the exellent work.
> 
> 
> 
>   private void printFolderCoverSheet 
> (com.filenet.wcm.api.Folder folder, 
> PdfOutline outline, int numDocs){
> 
> 
> 
>     PdfOutline tmpOutline;
> 
>     try {
> 
> 
> 
>       PdfReader reader = new PdfReader("FolderPrintCoverSheet.pdf");
> 
>       PdfStamper stamper = new PdfStamper(reader,
> 
>                                           new 
> FileOutputStream("C:\\hihi.pdf"));
> 
>       /**
> 
>       *  @todo better naming convention
> 
>       */
> 
>       AcroFields form = stamper.getAcroFields();
> 
> 
> 
>       HashMap fields = form.getFields();
> 
>       String key;
> 
> 
> 
>       for (Iterator i = fields.keySet().iterator(); i.hasNext(); ) {
> 
>         key = (String) i.next();
> 
> 
> 
>         // We retrieve a field name from the acro form. Field name is 
> defined as the last character sequence in the name hierarchy
> 
>         // which contains a [] at the end
> 
> 
> 
>         String acroFieldName = 
> key.substring(key.lastIndexOf(".")+1,key.lastIndexOf("["));
> 
>         System.out.print(acroFieldName + ": ");
> 
>         switch (form.getFieldType(key)) {
> 
>           case AcroFields.FIELD_TYPE_TEXT:        // We only 
> look at fields 
> of type text
> 
>             try{
> 
>               form.setField(key, getFolderProperty(folder, 
> acroFieldName)); 
> //getFolderProperty retrieves a property value from the 
> folder with the same 
> name property as the acro field name
> 
>             } catch (PropertyNotFoundException pnf){
> 
>                 // Explicitly do nothing when the property is 
> not found.
> 
>             }
> 
> 
> 
> 
> 
>         }
> 
>       }
> 
> 
> 
>       reader.close();
> 
>       stamper.setFormFlattening(true);
> 
>       stamper.close();
> 
> 
> 
>       //Append just created PDF to the output stream
> 
> 
> 
>       PdfReader pdfCoverReader = new PdfReader("C:\\hihi.pdf");
> 
>       PdfImportedPage pip = 
> _pdfWriter.getImportedPage(pdfCoverReader, 1);
> 
>       Image foo = Image.getInstance(pip);
> 
> 
> 
>       _pdfDocument.add(foo);
> 
>       _pdfDocument.newPage();
> 
>     }
> 
>     catch (DocumentException de) {
> 
>       System.out.println(de.getMessage());
> 
>     }
> 
>     catch (IOException ioe) {
> 
>       System.out.println(ioe.getMessage());
> 
>     }
> 
>   }
> 
> 
> 
> /DI Gerold Krommer
> 
> Manager Pre- und Postsales
> 
> ASTRON Business Services  G.m.b.H., Vienna, Austria
> 
> Tel.: +43 1 585 31 90-22
> 
> Fax: +43 1 585 31 90-15
> 
> 
> 
> CONFIDENTIAL NOTICE: The contents of this message, including any 
> attachments, are confidential and are intended solely for the 
> use of the 
> person or entity to whom the message was addressed. If you 
> are not the 
> intended recipient of this message, please be advised that any 
> dissemination, distribution, or use of the contents of this 
> message is 
> strictly prohibited. If you received this message in error, 
> please notify 
> the sender. Please also permanently delete all copies of the original 
> message and any attached documentation. Thank you.
> 
> ________________________________
> 
> Von: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Im 
> Auftrag von Paulo 
> Soares
> Gesendet: Freitag, 07. September 2007 16:58
> An: Post all your questions about iText here
> Betreff: Re: [iText-questions] Is a flattened form special?
> 
> 
> 
> Can you post hihi.pdf?
> 
> 
> 
> Paulo
> 
> 
> 
> 
> ________________________________
> 
> 
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Gerold 
> Krommer
> Sent: Friday, September 07, 2007 9:17 AM
> To: [email protected]
> Subject: [iText-questions] Is a flattened form special?
> 
> 
> 
> I am using iText 2.0.4 to create a single document out of 
> many document 
> contained in a DMS repository. This works flawlessly. Some of 
> the documents 
> in the DMS are already PDF and inclusion of them is no problem.
> 
> To separate the documents I insert a cover sheet with some 
> information about 
> the following document (date created, owner , whathaveyou) 
> and use a static 
> PDF form (created in LC Designer 7) to fill in the fields.
> 
> Then I flatten the single page form and want to include it in 
> my output 
> stream. The same code that works with other PDFs gives me an 
> empty page and 
> absolutely no error.
> 
> 
> 
> This is the absolutely trivial code snippet which I basically 
> copied from 
> 'iText in Action' which I'm a proud owner of.
> 
> 
> 
> PdfReader pdfCoverReader = new PdfReader("C:\\hihi.pdf");   
> <-- this is the 
> flattened form
> 
>       PdfImportedPage pip = 
> _pdfWriter.getImportedPage(pdfCoverReader, 1);
> 
>       Image foo = Image.getInstance(pip);
> 
>       _pdfDocument.add(foo);
> 
>       _pdfDocument.newPage();
> 
> 
> 
> Since this works in other places, this makes me wonder if 
> there is something 
> special about the flattened forms.
> 
> 
> 
> /DI Gerold Krommer
> 
> Manager Pre- und Postsales
> 
> ASTRON Business Services  G.m.b.H., Vienna, Austria
> 
> Tel.: +43 1 585 31 90-22
> 
> Fax: +43 1 585 31 90-15


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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/

Reply via email to