Class PDFPageExtractor


  • public class PDFPageExtractor
    extends Object
    Extract pages from a PDF.
    Since:
    8.10
    • Constructor Detail

      • PDFPageExtractor

        public PDFPageExtractor​(Blob inBlob)
      • PDFPageExtractor

        public PDFPageExtractor​(DocumentModel inDoc,
                                String inXPath)
        Constructor with a DocumentModel. Default value for inXPath (if passed null or ""), is file:content.
        Parameters:
        inDoc - Input DocumentModel.
        inXPath - Input XPath.
    • Method Detail

      • extract

        public Blob extract​(int inStartPage,
                            int inEndPage)
      • extract

        public Blob extract​(int inStartPage,
                            int inEndPage,
                            String inFileName,
                            String inTitle,
                            String inSubject,
                            String inAuthor)
                     throws NuxeoException
        Return a Blob built from page inStartPage to inEndPage (inclusive).

        If inEndPage is greater than the number of pages in the source document, it will go to the end of the document. If inStartPage is less than 1, it'll start with page 1. If inStartPage is greater than inEndPage or greater than the number of pages in the source document, a blank document will be returned.

        If fileName is null or "", if is set to the original name + the page range: mydoc.pdf and pages 10-75 +@gt; mydoc-10-75.pdf.

        The mimetype is always set to "application/pdf".

        Can set the title, subject and author of the resulting PDF. Notice: If the value is null or "", it is just ignored.

        Parameters:
        inStartPage - Number of first page to be included.
        inEndPage - Number of the last page to be included.
        inFileName - Name of the resulting PDF.
        inTitle - Title of the resulting PDF.
        inSubject - Subject of the resulting PDF.
        inAuthor - Author of the resulting PDF.
        Returns:
        FileBlob
        Throws:
        NuxeoException
      • setPassword

        public void setPassword​(String password)