Jim G created PDFBOX-1342:
-----------------------------

             Summary: Tags not fully preserved when merging PDFs.
                 Key: PDFBOX-1342
                 URL: https://issues.apache.org/jira/browse/PDFBOX-1342
             Project: PDFBox
          Issue Type: Bug
          Components: PDFReader
    Affects Versions: 1.7.0
         Environment: Java 1.6.0_26, PDFMergerUtility.
            Reporter: Jim G


When merging PDFs, 508 accessibility tags are only preserved on the first page 
of combined PDF.

Both PDFMergerUtility.mergeDocuments() and PDFMergerUtility..appendDocument() 
exhibit this behavior.

Example follows:

import java.io.*;
import java.util.*;
import org.apache.pdfbox.util.*;

public class PDFboxTest
{
        public PDFboxTest() {};

   private static String[] getFiles(String folder) throws IOException
   {
      File _folder = new File(folder);
      String[] filesInFolder;
      if(_folder.isDirectory())
      {
          filesInFolder = _folder.list();
          return filesInFolder;
      }
      else
      {
           throw new IOException("Path is not a directory");
      }
   }


    public static void main (String[] args) 
        {
            PDFMergerUtility mergePDF = new PDFMergerUtility();

                try {

                     mergePDF.addSource("file1.pdf");
                     mergePDF.addSource("file2.pdf");

                        ByteArrayOutputStream tempOutputStream = new 
ByteArrayOutputStream();
                        mergePDF.setDestinationStream(tempOutputStream );

                        File file = new File("resultFile.pdf");
                        FileOutputStream fos = new FileOutputStream(file);

             mergePDF.mergeDocuments();
             tempOutputStream.writeTo(fos);

            }
                catch (Exception e) {
                        System.out.println( " Exception: " + e.toString() );

                }
        }
}



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to