Finding a PDF Package or Portfolio in Code

Does anyone know how to determine if a given PDF file is a PDF portfolio or a PDF package, and not a “regular” PDF file? I would prefer Java solutions, although since I have not yet found any information about finding a particular type of PDF, I will take what I can get and they will try to figure out the Java solution afterwards.

(When looking for past questions, it seems like a group of people don’t know that there are such things as a PDF portfolio and PDF packages. Typically, both methods allow Adobe to split multiple discrete PDF files into one PDF file. Opening a PDF package in Reader shows the user a list of embedded PDF files and allows you to continue browsing.The PDF portfolio looks a bit more complicated: they also include a Flash browser for embedded files and then allow users to extract discrete PDF files from it. My problem with them and the reason I wanted would have discovered To eat them in the code is that the built-in Preview.app file for OS X cannot read these files - therefore, I would like to at least warn users of my web application that downloading them can lead to a decrease in compatibility between platforms.)

+4
source share
2 answers

This question is old, but in case someone wants to know, it is possible. This can be done using Acrobat and JavaScript using the following command.

if (Doc.collection() != null) { //It Is Portfolio } 

The Acrobat JavaScript API says: “The collection object is obtained from the Doc.collection property. Doc.collection returns zero when there is no PDF collection (also called PDF package and PDF portfolio). The collection object is used to set the source document in the collection, set the initial view of the collection and get, add and remove collection fields (or categories). "

0
source
 I'm also facing same problem while extracting data through kofax, but i got solution and its working fine need to add extra jar for Document class. import java.io.File; import java.io.IOException; import java.io.InputStream; public class PDFPortfolio { /** * @param args */ public static void main(String[] args) { com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("e:/pqr1.pdf"); // get collection of embedded files com.aspose.pdf.EmbeddedFileCollection embeddedFiles = pdfDocument.getEmbeddedFiles(); // iterate through individual file of Portfolio for(int counter=1; counter<=pdfDocument.getEmbeddedFiles().size();counter++) { com.aspose.pdf.FileSpecification fileSpecification = embeddedFiles.get_Item(counter); try { InputStream input = fileSpecification.getContents(); File file = new File(fileSpecification.getName()); // create path for file from pdf // file.getParentFile().mkdirs(); // create and extract file from pdf java.io.FileOutputStream output = new java.io.FileOutputStream("e:/"+fileSpecification.getName(), true); byte[] buffer = new byte[4096]; int n = 0; while (-1 != (n = input.read(buffer))) output.write(buffer, 0, n); // close InputStream object input.close(); output.close(); } catch (IOException e) { e.printStackTrace(); } } } } 
0
source

All Articles