Thank you very much!
The modified (and now working module) looks like this:

    public static void concatenateForms( List<String> fileNames, File  
outputFile )
    {
       if ( outputFile != null && fileNames != null &&  
fileNames.size() > 0 )
       {
          int pageOffset = 0;
          List<HashMap<String, Object>> master = new  
ArrayList<HashMap<String, Object>>();
          try
          {
             PdfCopyFields target = new PdfCopyFields(new  
FileOutputStream(outputFile));
             for (String f : fileNames)
             {
                log.info("Concatenating " + f + " to final document "  
+ outputFile.getAbsolutePath());
                PdfReader reader = new PdfReader(f);
                reader.consolidateNamedDestinations();
                int pageCount = reader.getNumberOfPages();
                List<HashMap<String, Object>> bookmarks =  
SimpleBookmark.getBookmark(reader);
                if ( bookmarks != null )
                {
                   if ( pageOffset != 0 )
                   {
                      SimpleBookmark.shiftPageNumbers(bookmarks,  
pageOffset, null);
                   }
                   master.addAll(bookmarks);
                }
                pageOffset += pageCount;
                target.addDocument(reader);
             }
             if ( !master.isEmpty() )
                target.setOutlines(master);

             target.close();
          }
          catch (FileNotFoundException fnfe)
          {
             fnfe.printStackTrace();
          }
          catch (DocumentException de)
          {
             de.printStackTrace();
          }
          catch (IOException ioe)
          {
             ioe.printStackTrace();
          }
       }
       else
       {
          log.error("No documents to concatenate");
       }
    }


On Jun 15, 2009, at 11:59 PM, 1T3XT info wrote:

> Robert Morse wrote:
>> Hate to bring this up again, but I think I'm facing the same issue.
>> The following method accepts a List of filenames, and then  
>> concatenates
>> them to a single document.
>> I have verified that each of the individual docs contain Bookmarks by
>> opening them in Adobe Reader.   In the final doc, they're missing.   
>> What
>> am I missing?
>> I lifted 99% of the code from page 67 of the book.
>
> When concatenating PDFs with PdfCopy (and PdfCopyFields),
> you mustn't forget to concatenate the Bookmarks (outlines) too.
> For inspiration, have a look at: http://1t3xt.be/?Z0004de
> -- 
> This answer is provided by 1T3XT BVBA
> http://www.1t3xt.com/ - http://www.1t3xt.info
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Check the site with examples before you ask questions: 
> http://www.1t3xt.info/examples/
> You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

The human mind is an iterative processor, it never does anything right  
the first time.  What it does well is to make improvements on every  
iteration (deMarco)




------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to