Okay,
With a the great assistance of Paulo, I have the software working properly. However there is a problem which appears to be a bug.
Here's my implementation:
copy = new PdfCopy ( this, outputStream );
this.open ();
contentByte = null;
boolean first = true;
for ( Iterator i = form.getGalleryPages ().iterator (); i.hasNext (); ) {
// Import PDF document and place on page.
pageInputStream = ( InputStream ) i.next ();
reader = new PdfReader ( inputStreamAsByteArray ( pageInputStream ) );
if ( first ) {
// Format the first page of the document and annotate the personal info...
first = false;
document = new Document();
// document.setPageSize( PageSize.LETTER.rotate() );
writer = PdfWriter.getInstance( document, firstPageOutputStream );
document.open ();
importedPage = writer.getImportedPage ( reader, 1 );
contentByte = writer.getDirectContent ();
contentByte.addTemplate ( importedPage, 0, 0 );
addPersonalData ( contentByte, importedPage, form );
document.close();
reader = new PdfReader( firstPageOutputStream.toByteArray() );
} else if ( ! i.hasNext() ) {
// Must be the last page...
document = new Document ();
writer = PdfWriter.getInstance ( document, lastPageOutputStream );
document.open ();
importedPage = writer.getImportedPage ( reader, 1 );
contentByte = writer.getDirectContent ();
contentByte.addTemplate ( importedPage, 0, 0 );
// TODO: Add annotation here for dealer info page...
document.close();
reader = new PdfReader ( lastPageOutputStream.toByteArray () );
}
dumpPages( reader, copy );
}
this.close ();
This code works. However, the first page comes in Portrait orientation which does not match the rest of the documents. If I uncomment the setPageSize method call to make the first page landscape format, then it fails. While the document generates, and the hyperlinks show a hand click on them, nothing happens when you click. If I leave the first page as portrait, the hyperlinks work as advertised.
Is this a bug in iText or should I be rotating the page differently?
Andrew
------------------------------------------------------- This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions