Detect if a PDF File is a Portfolio in Java

This article demonstrates how to detect if a PDF file is a portfolio in Java using Spire.PDF for Java.

The following is the screenshot of the input PDF:

Detect if a PDF File is a Portfolio in Java

import com.spire.pdf.PdfDocument;

public class DetectPortfolio {
    public static void main(String []args){
        //Create a PdfDocument instance
        PdfDocument doc = new PdfDocument();
        //Load the PDF file
        doc.loadFromFile("Portfolio.pdf");

        //Detect if the PDF is a portfolio
        boolean value = doc.isPortfolio();
        if (value)
        {
            System.out.println("The document is a portfolio.");
        }
        else
        {
            System.out.println("The document is not a portfolio.");
        }
    }
}

Output:

Detect if a PDF File is a Portfolio in Java