/** * Returns the page tree. * * @return the page tree */ public PDPageTree getPages() { return getDocumentCatalog().getPages(); }
/** * This will return the total page count of the PDF document. * * @return The total number of pages in the PDF document. */ public int getNumberOfPages() { return getDocumentCatalog().getPages().getCount(); }
/** * Returns the page at the given 0-based index. * <p> * This method is too slow to get all the pages from a large PDF document * (1000 pages or more). For such documents, use the iterator of * {@link PDDocument#getPages()} instead. * * @param pageIndex the 0-based page index * @return the page at the given index. */ public PDPage getPage(int pageIndex) // todo: REPLACE most calls to this method with BELOW method { return getDocumentCatalog().getPages().get(pageIndex); }
/** * Returns the page tree. * * @return the page tree */ public PDPageTree getPages() { return getDocumentCatalog().getPages(); }
/** * Returns the page tree. * * @return the page tree */ public PDPageTree getPages() { return getDocumentCatalog().getPages(); }
/** * This will return the total page count of the PDF document. * * @return The total number of pages in the PDF document. */ public int getNumberOfPages() { return getDocumentCatalog().getPages().getCount(); }
/** * Returns the page at the given index. * * @param pageIndex the page index * @return the page at the given index. */ public PDPage getPage(int pageIndex) // todo: REPLACE most calls to this method with BELOW method { return getDocumentCatalog().getPages().get(pageIndex); }
/** * This will return the total page count of the PDF document. * * @return The total number of pages in the PDF document. */ public int getNumberOfPages() { return getDocumentCatalog().getPages().getCount(); }
/** * Returns the page at the given 0-based index. * <p> * This method is too slow to get all the pages from a large PDF document * (1000 pages or more). For such documents, use the iterator of * {@link PDDocument#getPages()} instead. * * @param pageIndex the 0-based page index * @return the page at the given index. */ public PDPage getPage(int pageIndex) // todo: REPLACE most calls to this method with BELOW method { return getDocumentCatalog().getPages().get(pageIndex); }
/** * Ik geef de tekst terug uit het PDF bestand, waarbij ik alleen kijk naar een * opgegeven visueel gebied. Dit gebied kun je defineren door x,y,breedte en hoogte * op te geven, en het pagina nummer in de pdf waar dit gebied zich bevind. * * @param paginaNr * @param x * @param y * @param width * @param height * @return * @throws Exception */ public static String pdfTextFromRegion(PDDocument pdf, int paginaNr, int x, int y, int width, int height) throws Exception { PDFTextStripperByArea stripper = new PDFTextStripperByArea(); stripper.setSortByPosition(true); Rectangle rect = new Rectangle(x, y, width, height); stripper.addRegion("class1", rect); List allPages = (List) pdf.getDocumentCatalog().getPages(); if (paginaNr > 0 && paginaNr <= allPages.size()) { PDPage page = (PDPage) allPages.get((paginaNr - 1)); stripper.extractRegions(page); return stripper.getTextForRegion("class1"); } else { throw new Exception("Pagina nummer buiten bereik van pdf"); } }
void sanitize(PDDocumentCatalog docCatalog) throws IOException { sanitizeOpenAction(docCatalog); sanitizeDocumentActions(docCatalog.getActions()); sanitizePageActions(docCatalog.getPages()); sanitizeAcroFormActions(docCatalog.getAcroForm()); } }
protected void addCoverPageToDocument(PDDocument document, PDDocument sourceDocument, PDPage coverPage) { PDPageTree sourcePageList = sourceDocument.getDocumentCatalog().getPages(); if (isCitationFirstPage()) { //citation as cover page document.addPage(coverPage); for (PDPage sourcePage : sourcePageList) { document.addPage(sourcePage); } } else { //citation as tail page for (PDPage sourcePage : sourcePageList) { document.addPage(sourcePage); } document.addPage(coverPage); } }
private void getCatalogFeatures(PDDocumentCatalog catalog) { reporter.report(PBFeaturesObjectCreator.createMetadataFeaturesObject(catalog.getMetadata())); reporter.report(PBFeaturesObjectCreator.createOutlinesFeaturesObject(catalog.getDocumentOutline())); PDAcroForm acroForm = catalog.getAcroForm(); if (acroForm != null) { getAcroFormFeatures(acroForm); } if (catalog.getNames() != null && catalog.getNames().getEmbeddedFiles() != null) { reportEmbeddedFiles(catalog); } if (catalog.getOutputIntents() != null) { for (PDOutputIntent outInt : catalog.getOutputIntents()) { String iccProfileID = addICCProfileFromOutputIntent(outInt); if (!config.isFeatureEnabled(FeatureObjectType.ICCPROFILE)) { iccProfileID = null; } reporter.report(PBFeaturesObjectCreator.createOutputIntentFeaturesObject(outInt, iccProfileID)); } } PDPageTree pageTree = catalog.getPages(); if (pageTree != null) { getPageTreeFeatures(pageTree); } }
for (Object page : catalog.getPages()) { pageNumber += 1; PdfPageMetadata pageMetadata = new PdfPageMetadata();