You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Jim G (JIRA)" <ji...@apache.org> on 2012/06/14 20:40:42 UTC

[jira] [Updated] (PDFBOX-1342) Tags not fully preserved when merging PDFs.

     [ https://issues.apache.org/jira/browse/PDFBOX-1342?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jim G updated PDFBOX-1342:
--------------------------

    Attachment: PDFboxTest.java

Example code of problem.
                
> 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
>         Attachments: PDFboxTest.java
>
>
> 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