public static void Main(string[] args) { PDDocument document = null; try { document = PDDocument.load(@"pdfpath"); if (document.isEncrypted()) { try { document.decrypt(""); } catch { } } Program printer = new Program(); var allPages = document.getDocumentCatalog().getAllPages(); //for (int i = 0; i < allPages.size(); i++) { PDPage page = (PDPage)allPages.get(0); PDStream contents = page.getContents(); if (contents != null) { printer.processStream(page, page.findResources(), page.getContents().getStream()); } Console.ReadLine(); } } finally { if (document != null) { document.close(); } } } protected internal override void processTextPosition(TextPosition text) { string test = "String[" + text.getXDirAdj() + "," + text.getYDirAdj() + " fs=" + text.getFontSize() + " xscale=" + text.getXScale() + " height=" + text.getHeightDir() + " space=" + text.getWidthOfSpace() + " width=" + text.getWidthDirAdj() + "]" + text.getCharacter(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)