/** * Remove the page from the document. * * @param page The page to remove from the document. */ public void removePage(PDPage page) { getPages().remove(page); }
/** * This will add a page to the document. This is a convenience method, that will add the page to the root of the * hierarchy and set the parent of the page to the root. * * @param page The page to add to the document. */ public void addPage(PDPage page) { getPages().add(page); }
/** * Remove the page from the document. * * @param pageNumber 0 based index to page number. */ public void removePage(int pageNumber) { getPages().remove(pageNumber); }
public int getPageCount() { return doc.getPages().getCount(); }
private void extract(String pdfFile, String password) throws IOException { try (PDDocument document = PDDocument.load(new File(pdfFile), password)) { AccessPermission ap = document.getCurrentAccessPermission(); if (!ap.canExtractContent()) { throw new IOException("You do not have permission to extract images"); } for (PDPage page : document.getPages()) { ImageGraphicsEngine extractor = new ImageGraphicsEngine(page); extractor.run(); } } }
public PageEntry getPage(int index) { PDPage page = doc.getPages().get(index); String pageLabel = PDFDebugger.getPageLabel(doc, index); return new PageEntry(page.getCOSObject(), index + 1, pageLabel); }
public PagePane(PDDocument document, COSDictionary pageDict, JLabel statuslabel) { page = new PDPage(pageDict); pageIndex = document.getPages().indexOf(page); this.document = document; this.statuslabel = statuslabel; initUI(); initRectMap(); }
/** * This will print the documents data. * * @param args The command line arguments. * * @throws IOException If there is an error parsing the document. */ public static void main( String[] args ) throws IOException { if( args.length != 1 ) { usage(); } else { try (PDDocument document = PDDocument.load(new File(args[0]))) { PrintImageLocations printer = new PrintImageLocations(); int pageNum = 0; for( PDPage page : document.getPages() ) { pageNum++; System.out.println( "Processing page: " + pageNum ); printer.processPage(page); } } } }
private static void changeCropBox(PDDocument document, float a, float b, float c, float d) { for (PDPage page : document.getPages()) { System.out.println("resizing page"); PDRectangle rectangle = new PDRectangle(); rectangle.setLowerLeftX(a); rectangle.setLowerLeftY(b); rectangle.setUpperRightX(c); rectangle.setUpperRightY(d); page.setCropBox(rectangle); } } }
for (PDPage page : document.getPages())
/** * This will take a PDDocument and write the text of that document to the print writer. * * @param doc The document to get the data from. * @param outputStream The location to put the text. * * @throws IOException If the doc is in an invalid state. */ public void writeText(PDDocument doc, Writer outputStream) throws IOException { resetEngine(); document = doc; output = outputStream; if (getAddMoreFormatting()) { paragraphEnd = lineSeparator; pageStart = lineSeparator; articleStart = lineSeparator; articleEnd = lineSeparator; } startDocument(document); processPages(document.getPages()); endDocument(document); }
System.exit(1); for (PDPage page : document.getPages())
for (PDPage page : document.getPages())
for( PDPage page : doc.getPages() )
for( PDPage page : doc.getPages() )
for (PDPage page : document.getPages())
outline.addLast( pagesOutline ); int pageNum = 0; for( PDPage page : document.getPages() )
private void processPages(PDDocument document) throws IOException for (PDPage page : document.getPages())
float fontSize = 36.0f; for( PDPage page : doc.getPages() )
for (PDPage page : sourceDoc.getPages())