public static void main(String[] args) throws Exception { // The path to the documents directory. String dataDir = Utils.getDataDir(GetNumberofPages.class); // open document com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(dataDir + "input1.pdf"); // get page count System.out.printf("Page Count :- " + pdfDocument.getPages().size()); }
public static void main(String[] args) throws Exception { // The path to the documents directory. String dataDir = Utils.getDataDir(ReplaceImage.class); // open input PDF PdfContentEditor pdfContentEditor = new PdfContentEditor(); pdfContentEditor.bindPdf(dataDir + "Input.pdf"); // replace image on a particular page pdfContentEditor.replaceImage(1, 1, dataDir + "image2.bmp"); // save output PDF pdfContentEditor.save(dataDir + "Output.pdf"); }
public static void main(String[] args) throws Exception { // The path to the documents directory. String dataDir = Utils.getDataDir(SearchGetTextPage.class); // open document com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(dataDir + "input.pdf"); // create TextAbsorber object to find all instances of the input search phrase com.aspose.pdf.TextFragmentAbsorber textFragmentAbsorber = new com.aspose.pdf.TextFragmentAbsorber("sample"); // accept the absorber for first page of document pdfDocument.getPages().get_Item(1).accept(textFragmentAbsorber); // get the extracted text fragments into collection com.aspose.pdf.TextFragmentCollection textFragmentCollection = textFragmentAbsorber.getTextFragments(); // loop through the fragments for (com.aspose.pdf.TextFragment textFragment : (Iterable<com.aspose.pdf.TextFragment>) textFragmentCollection) { System.out.println("Text :- " + textFragment.getText()); System.out.println("Position :- " + textFragment.getPosition()); System.out.println("XIndent :- " + textFragment.getPosition().getXIndent()); System.out.println("YIndent :- " + textFragment.getPosition().getYIndent()); System.out.println("Font - Name :- " + textFragment.getTextState().getFont().getFontName()); System.out.println( "Font - IsAccessible :- " + textFragment.getTextState().getFont().isAccessible()); System.out.println( "Font - IsEmbedded - " + textFragment.getTextState().getFont().isEmbedded()); System.out.println("Font - IsSubset :- " + textFragment.getTextState().getFont().isSubset()); System.out.println("Font Size :- " + textFragment.getTextState().getFontSize()); System.out.println("Foreground Color :- " + textFragment.getTextState().getForegroundColor()); System.out.println("\n"); } // Print message System.out.println("Successfully finished."); }
public static void main(String[] args) throws Exception { // The path to the documents directory. String dataDir = Utils.getDataDir(UnderlineOverlineStrikeOut.class); System.out.println("This example will be available very soon."); }
public static void main(String[] args) throws Exception { // The path to the documents directory. String dataDir = Utils.getDataDir(ExtractImagesRangeOfPages.class); System.out.println("This example will be available very soon."); }
public static void main(String[] args) throws Exception { // The path to the documents directory. String dataDir = Utils.getDataDir(CreateFileAnnotationWithoutIcon.class); System.out.println("This example will be available very soon."); }