Hi, 
can anyone help me with this issue? 

Currently writing a program that creates  a PDF dynamically and based on
that concatenates some files at the end. There are also internal links
(created with set local destination etc.) that point to the concatenated
files. 

PdfReader reader = new PdfReader(report); 
int n = reader.NumberOfPages; 
int i = 0;  // Page Index Counter 
while (i < n) 
{ 
        i++; 
        document.SetPageSize(reader.GetPageSizeWithRotation(i)); 
        document.NewPage(); 
        if(i==1) 
        { 
                // Create a local destination since we made a link in the
agenda 
                cb.LocalDestination(...); 
        } 
        page = writer.GetImportedPage(reader, i); 
        rotation = reader.GetPageRotation(i); 
        if (rotation == 90 || rotation == 270) 
        { 
                cb.AddTemplate(page, 0, -1f, 1f, 0, 0,
reader.GetPageSizeWithRotation(i).Height); 
        } 
        else 
        { 
                cb.AddTemplate(page, 1f, 0, 0, 1f, 0, 0); 
        } 
} 
reader.Close(); 


Disadvantage of this method is that isn't capable of copying the outline of
the file you are concatinating into the PdfWriter. (If this isn't true,
please tell me how I can add bookmarks using this concatenating method). And
it also doesn't copy any annotations from the concatenated files into the
main document. From what I've read, PdfCopy can do add the annotation
(though addPage) and the outlines (setoutline), but if I use PdfCopy I can't
create the dynamic pages that reference the concatenated files. (Again same
here, if it can be done, please let me know how). 

/* chapter02/HelloWorldCopy.java */ 
PdfReader reader = new PdfReader("Hello1.pdf"); 
Document document = new Document(reader.getPageSizeWithRotation(1)); 
PdfCopy copy = new PdfCopy(document, 
new FileOutputStream("HelloWorldPdfCopy123.pdf")); 
document.open(); 
System.out.println("Tampered? " + reader.isTampered()); 
copy.addPage(copy.getImportedPage(reader, 1)); 
reader = new PdfReader("Hello2.pdf"); 
copy.addPage(copy.getImportedPage(reader, 1)); 
reader = new PdfReader("Hello3.pdf"); 
copy.addPage(copy.getImportedPage(reader, 1)); 
System.out.println("Tampered? " + reader.isTampered()); 
document.close(); 

So the big question is: How can I dynamically create a PDF and then
concatenate files into that PDF while maintining the outlines and
annotations of that PDF. Since I'm making references in the Concatenated
files Its not a real option to create the dynamic PDF first and then save it
and then concatenate all the files including PDF (unless you know a good way
of adding the links later) 

So my thoughts were to make a kind of subclass of PdfWriter that has the
capability of creating dynaically the PDF but also has the good things
PdfCopy has for maintaining annotations & outlines when concatenating files
to the dynamically created PDF. 

Is there anyone who can give me some direction and/or pointers to solve this
problem? 

Thanks, 

-- 
View this message in context: 
http://www.nabble.com/PdfWriter-with-PdfCopy-Capabilities-tf3799240.html#a10747998
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/

Reply via email to