无法识别pdf文件.zip (461.5 KB)
pdf文件,调用如下代码判断文件类型,返回false,正确结果应该是应该返回true
pdfFileInfo = new PdfFileInfo(fileName);
return pdfFileInfo.isPdfFile();
另如下代码判断文件类型返回true。
com.aspose.words.FileFormatInfo info = com.aspose.words.FileFormatUtil.detectFileFormat(fileName);
boolean isWord = (info.getLoadFormat()!=255);
补充说明:调用pdf转html文件相关接口,可以正确转换为html文件。
转换代码如下:
com.aspose.pdf.Document document = new com.aspose.pdf.Document(sourceFileName);
File path = new File(targetFileName.substring(0, targetFileName.lastIndexOf(’.’)));
path.mkdirs();
Resolution resolution = new Resolution(200);
JpegDevice device = new JpegDevice(1080,1920,resolution);
PageCollection pages = document.getPages();
for (int i = 1; i <= pages.size(); i++){
File file = new File(path+"/"+(i-1)+".jpg");// 输出路径
file.createNewFile();
FileOutputStream fileOS = new FileOutputStream(file);
device.process(pages.get_Item(i), fileOS);
fileOS.close();
}
buildSlideMobileHtml(targetFileName, path, pages.size());
document.close();
@xiangma,
关于Aspose.Words for Java,我们测试了这种情况,并设法在我们的末端重现了同样的问题。 为了更正,我们已将此问题记录在问题跟踪系统中。 此问题的ID是WORDSNET-19937。 我们将进一步调查该问题的详细信息,并让您及时了解更正的状态。 对于给您带来的不便,我们深表歉意。
我们还将检查您的其他问题,并将尽快与您联系。
The issues you have found earlier (filed as WORDSNET-19937) have been fixed in this Aspose.Words for .NET 20.3 update and this Aspose.Words for Java 20.3 update.