public void generatePDF ( OutputStream outputStream ) { PdfReader reader = null; PdfImportedPage importedPage = null; InputStream pageInputStream = null;
try {
// PdfWriter writer = PdfWriter.getInstance ( this, outputStream );
PdfCopy writer = new PdfCopy( this, outputStream );
this.open ();
PdfContentByte contentByte = writer.getDirectContent ();
boolean first = true;
for ( Iterator i = form.getGalleryPages ().iterator (); i.hasNext (); ) {
this.newPage ();
// Import PDF document and place on page.
pageInputStream = ( InputStream ) i.next ();
reader = new PdfReader ( inputStreamAsByteArray ( pageInputStream ) );
int pages = reader.getNumberOfPages ();
for ( int j = 0 ; j < pages ; j++ ) {
importedPage = writer.getImportedPage ( reader, j+1 );
// contentByte.addTemplate ( importedPage, 0, 0 );
writer.addPage( importedPage );
if ( first ) {
first = false;
addPersonalData ( contentByte, importedPage, form );
}
if ( j < pages ) this.newPage();
}
}
this.close ();
} catch ( Exception e ) {
e.printStackTrace();
log.fatal ( "Unable to process PDF document.", e );
}
}
You'll notice the commented out reference to PdfWriter. One note is that I appear to be using iText 0.96. Should I be on a later rev?
Andrew
On May 20, 2004, at 2:57 AM, Paulo Soares wrote:
You have to use PdfCopy to keep the links.
Best Regards, Paulo Soares
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew McLaughlin Sent: Thursday, May 20, 2004 12:02 AM To: [EMAIL PROTECTED] Subject: [iText-questions] Embedded links lost
Hi all,
I am working on a project that will dynamically built a pdf document from smaller pdf documents. These other documents also have embedded html links which work fine on their own. However, when I complete the integration using iText, the links no longer work. Am I doing something wrong? Is there a special feature I have to enable to make those work again?
Thanks, Andrew
------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions
