Hi folk!

 

My email is about this code:

 

#1 .open document

 

open();

 

try{

                        PdfWriter.getInstance(doc,new FileOutputStream(nombreFichero));

                        addMetadata();

                        doc.open();

            }catch(DocumentException dex)

            {

                                   dex.printStackTrace();

            }

            catch(FileNotFoundException fnfex)

            {

                                   fnfex.printStackTrace();

            }

 

 

#2. add meta data information

 

addmetadata(); //metadata is a hashtable object which contains values to add metadata information it.

 

            if(metadata.containsKey("title"))

                        {

                                   doc.addTitle((String)metadata.get("title"));

                        }

                        if(metadata.containsKey("subject"))

                        {                                 

                                   doc.addSubject((String)metadata.get("subject"));

                        }

                        if(metadata.containsKey("keywords"))

                        {                      

                                   doc.addKeywords((String)metadata.get("keywords"));

                        }

                        if(metadata.containsKey("creator"))

                        {                      

                                   doc.addCreator((String)metadata.get("creator"));

                        }

                        if(metadata.containsKey("author"))

                        {                                 

                                   doc.addAuthor((String)metadata.get("author"));

                        }

 

#3. open doc object

 

Doc.open();

 

..then…

 

Why does occur this one?

 

 

Exception in thread "main" ExceptionConverter: com.lowagie.text.DocumentException: The document is open; you can only add Elements with content.

 

 

Thanks to help me!

 

Kind regards,

 

Abelardo.

-------------------------------------------------------------------------
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

Reply via email to