Detect if a PDF File is a Portfolio in Java

2021-07-27 07:09:16 Written by  support iceblue
Rate this item
(0 votes)

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

Additional Info

  • tutorial_title:
Last modified on Thursday, 02 September 2021 06:17