Viewer viewer = new Viewer(); viewer.setupViewer(); viewer.executeCommand(ViewerCommands.OPENFILE, "pdfFile.pdf");
ConvertPagesToImages.writeAllPagesAsImagesToDir("inputFileOrDir", "outputDir", "bmp", 1.33f);
ExtractTextAsWordList.writeAllWordlistsToDir("inputFileOrDirectory", "outputDir", -1);
ArrayList<Float[]> resultsForPages = FindTextInRectangle.findTextOnAllPages("/path/to/file.pdf", "textToFind");
PrintPdfPages print = new PrintPdfPages("C:/pdfs/mypdf.pdf"); if (print.openPDFFile()) { print.printAllPages("Printer Name"); }
final PdfUtilities utilities = new PdfUtilities("path/to/exampleFile.pdf"); try { if (utilities.openPDFFile()) { // Returns a String containing all metadata fields for the document final String documentPropertiesAsXML = utilities.getDocumentPropertyFieldsInXML(); // Returns the total page count as an int final int totalPageCount = utilities.getPageCount(); for (int i = 1; i != totalPageCount; i++) { // Get the page dimensions for the specified page in the given units and type final float[] pageDimensions = utilities.getPageDimensions(i, PdfUtilities.PageUnits.Pixels, PdfUtilities.PageSizeType.CropBox); // Returns the image data as a String for the specified page final String xImageDataForPage = utilities.getXImageDataForPage(i); } } } catch (final PdfException e) { e.printStackTrace(); } utilities.closePDFfile();
WritableAnnotation[] annotations = new WritableAnnotation[2]; annotations[0] = new SquareAnnotation(1, 10, 10, 100, 100); annotations[1] = new CircleAnnotation(2, 10, 10, 100, 100); AnnotationWriter.writeAnnotations(inputFile, outputFile, annotation);
ExtractClippedImages.writeAllClippedImagesToDir("inputFileOrDirectory", "outputDir", "outputImageFormat", new String[] {"imageHeightAsFloat", "subDirectoryForHeight"});