Q: We use Qoppa PDF library jPDFProcess to convert PDF documents uploaded by users into TIFF format for one of our applications. We’ve just seen an Adobe PDF Portfolio document (containing 3 separate PDFs) that was attempted to be uploaded to our application, and the resulting TIFF was a single page sheet from Adobe reading: For the best experience, open this PDF portfolio in Acrobat X or Adobe Reader X or later. How can we print the PDFs attached to this portfolio?
Portfolio Adobe Place Holder Page

A: Portfolio PDFs are PDF documents that can hold multiple PDFs as attachment. They are intended to be empty shell used to hold multiple PDFs, so normally the content area of the PDF does not hold much.

Typically, an application that creates them will put a placeholder page for the main PDF content, and then attached the actual PDFs that are part of the portfolio. The page that you are seeing when you convert is the placeholder page.

PDF viewers will detect that a PDF is a portfolio and then ignore the place holder page and display a list of the attached PDFs. A user can then choose which PDF to view from the portfolio.

This is an interactive mechanism, with a user, so this doesn’t work in an automated processing context, such as when you are running conversions with jPDFProcess. But, we do provide the API so you can detect and decide what to do:

  • PDFDocument.isPortfolio() – This method will return true if the PDF is a portfolio PDF. You can call this method after you open a PDF to treat it differently.
  • PDFDocument.getEmbeddedFiles() – This method will return a list of embedded files (attachments) inside the PDF, so you can get a list of the documents that are inside the portfolio. The method returns a list of IEmbeddedFile objects, which have methods to get the file name and to get the file content.
  • For each embedded file, you can look at the file name to determine its type (.pdf, or some other type) to decide what to do with the attachment.
  • If you want to convert PDF attachments to TIFF, you can create a new PDFDocument object with an input stream from an embedded file, i.e.: PDFDocument embeddedPDF = new PDFDocument(embeddedFile.getInputStream(), null);

You will also need to decide how to work with multiple files, i.e. if there are 3 embedded PDFs in a portfolio, you will need to decide if you will output 3 separate TIFF files, etc…