Pdf文字坐标重叠

我使用aspose pdf for java,从一个PDF文件中抽取文字,但遇到坐标重叠问题。
文字的位置坐标会重叠在一起。

坐标重叠.pdf (292.7 KB)

@qixizhu,
请分享您的代码,并突出显示坐标重叠的文本项。我们将与您一起研究并分享我们的发现。

Best Regards,
Imran Rafique

@qixizhu,

添加更多的Imran的意见,我已经测试了从PDF文件提取文本的场景,使用以下代码片段,最新版本的Aspose.Pdf for Java 17.7,我无法注意到任何问题。 你可以分享一些进一步的细节,这可以帮助我们识别我们的环境中的问题。

同时为了您的参考,我还附上了图像文件,显示PDF和记事本文件中的文本的比较,以及从PDF文档中添加了包含提取内容的.txt文件。

Extracted_Text.PNG (62.7 KB)
ExtractedText.zip (1.1 KB)

[Java]

// open document
   Document pdfDocument = new Document("c:/pdftest/坐标重叠.pdf");
   // create text device
   com.aspose.pdf.devices.TextDevice textDevice = new com.aspose.pdf.devices.TextDevice();

   // set text extraction options - set text extraction mode (Raw or Pure)
   TextExtractionOptions textExtOptions = new TextExtractionOptions(TextExtractionOptions.TextFormattingMode.Raw);

   textDevice.setExtractionOptions(textExtOptions);

   // get the text from first page of PDF and save it to file format
   textDevice.process(pdfDocument.getPages().get_Item(1), "c:/pdftest/ExtractedText.txt");