用PDF x&y坐标值写入Excel

我是这个Java世界的新手。 使用PDFBox PrintTextlocations,我可以使用下面的代码从PDF文件中读取x和y坐标值。

public class PrintTextLocations extends PDFTextStripper { public PrintTextLocations() throws IOException { super.setSortByPosition(true); } public static void main(String[] args) throws Exception { PDDocument document = null; try { File input = new File("abcdef.pdf"); document = PDDocument.load(input); if (document.isEncrypted()) { document.decrypt(""); } PrintTextLocations printer = new PrintTextLocations(); List allPages = document.getDocumentCatalog().getAllPages(); for (int i = 0; i < allPages.size(); i++) { PDPage page = (PDPage) allPages.get(i); System.out.println("Processing page: " + i); PDStream contents = page.getContents(); if (contents != null) { printer.processStream(page, page.findResources(), page.getContents().getStream()); } } } finally { if (document != null) { document.close(); } } } @Override protected void processTextPosition(TextPosition text) { System.out.println("String[X:" + text.getXDirAdj() + ", Y:" + text.getYDirAdj() + " fs=" + text.getFontSize() + " xscale=" + text.getXScale() + " height=" + text.getHeightDir() + " space=" + text.getWidthOfSpace() + " width=" + text.getWidthDirAdj() + "]" + text.getCharacter()); } } 

通过谷歌search我得到了上面的代码。 现在我得到了如下的控制台输出。

 Processing page: 0 String[X:453.9598, Y:155.16022 fs=13.92 xscale=13.89324 height=10.523516 space=3.8623211 width=9.266785]S String[X:463.19983, Y:155.16022 fs=13.92 xscale=13.89324 height=7.7951965 space=3.8623211 width=7.72464]a String[X:470.99982, Y:155.16022 fs=13.92 xscale=13.89324 height=9.994557 space=3.8623211 width=3.8623352]l String[X:474.8398, Y:155.16022 fs=13.92 xscale=13.89324 height=7.7951965 space=3.8623211 width=7.72464]e String[X:482.63977, Y:155.16022 fs=13.92 xscale=13.89324 height=7.7951965 space=3.8623211 width=7.72464]s String[X:490.43976, Y:155.16022 fs=13.92 xscale=13.89324 height=0.0 space=3.8623211 width=3.8623352] String[X:494.27975, Y:155.16022 fs=13.92 xscale=13.89324 height=1.8095994 space=3.8623211 width=4.6264343]- String[X:498.95978, Y:155.16022 fs=13.92 xscale=13.89324 height=0.0 space=3.8623211 width=3.8623352] 

我的问题是,使用上面的x和y值,我怎么能写入到Excel工作表的值。 我需要根据PDF格式在确切的地方插入。 请帮助我。 提前thnks。