Hello,
Hi Klaus,
Thank you.
Hi Klaus,
Hi there,
If you're having trouble reproducing it, here's a full example which doesn't use any of our own code.
import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; import java.nio.charset.StandardCharsets; import com.aspose.pdf.Document; import com.aspose.pdf.License; import com.aspose.pdf.PageCollection; import com.aspose.pdf.TextAbsorber; public class PdfConversionTest { private static final String LICENCE_DATA = "<>"; public static void main(String[] args) throws Exception { new License().setLicense(new ByteArrayInputStream(LICENCE_DATA.getBytes(StandardCharsets.UTF_8))); File dir = new File("/INSERT BASE DIR HERE"); File inputFile = new File(dir, "x00982a00-x009a0840.pdf"); File outputFile = new File(dir, "x00982a00-x009a0840.txt"); try (InputStream inputStream = new FileInputStream(inputFile); OutputStream outputStream = new FileOutputStream(outputFile); PrintStream output = new PrintStream(outputStream, false, "UTF-8")) { PageCollection pageCollection = new Document(inputStream).getPages(); int numberOfPages = pageCollection.size(); for (int i = 1; i <= numberOfPages; i++) { if (i > 1) { output.print("\n\f"); } TextAbsorber textAbsorber = new TextAbsorber(); textAbsorber.visit(pageCollection.get_Item(i)); output.print(textAbsorber.getText()); } } } }
Attaching the example file I have been testing with, since it’s data-dependent as well as OS-dependent.
Hi there,
Thanks for sharing source code/document. We have managed to reproduce the reported Null key exception on linux using Aspose.Pdf for Java 4.4.0 and logged it in our bug tracking system as PDFNEWJAVA-33904 for further investigation and resolution. We will notify you via this thread as soon as it is resolved.
Please feel free to contact us for any further assistance.
Best Regards,
We are also getting this exception on CentOS using 4.4.0. Can anyone give us an general time frame when this bug will be addressed? We are in the middle of purchasing Aspose.PDF for Java and this bug could be a show stopper for us.
Many thanks.
Hi John,
Can you give an example of what the setLocalFontPath() call should look like when there is more than one font path, as is the case on Linux and Mac OS X?
Hi there,
I’m not sure if this will be helpful to anyone or not, but what we are seeing in our situation is that the problem isn’t necessary just the font path, but also that the actual font the PDF contains/refers to is not installed in the Linux environment we’re testing in (all of our tests were passing on Windows, but many were failing on Linux). We’re performing more tests, but that’s what it’s looking like so far.
To the Aspose Team… Does Aspose distribute font packs either with their libraries or as a separate download with the purchase of a library? Seems like this would be a way to help minimize this type of platform dependent issue.
Thanks.
Interesting.
To nuix:
1. Agree
2. In our case, we are replacing text.
Regards
nuix:Can you give an example of what the setLocalFontPath() call should look like when there is more than one font path, as is the case on Linux and Mac OS X?The Javadoc for the method is completely empty in version 4.5.0.All the other Aspose APIs we're using accept a list or an array for the font paths.
jalchin:I'm not sure if this will be helpful to anyone or not, but what we are seeing in our situation is that the problem isn't necessary just the font path, but also that the actual font the PDF contains/refers to is not installed in the Linux environment we're testing in (all of our tests were passing on Windows, but many were failing on Linux). We're performing more tests, but that's what it's looking like so far.
jalchin:
To the Aspose Team... Does Aspose distribute font packs either with their libraries or as a separate download with the purchase of a library? Seems like this would be a way to help minimize this type of platform dependent issue.
Hi there,
//adding
a new font path<o:p></o:p>
String path = "c:\\fonts\\";
com.aspose.pdf.Document.addLocalFontPath(path);
//geting the list for standard font directories in different OS
java.util.List list = com.aspose.pdf.Document.getLocalFontPaths();
//seting the user list for standard font directories
list.add("c:\\fonts2\\");
list.add("c:\\fonts3\\");
com.aspose.pdf.Document.setLocalFontPaths(list);
//Restoring list for standard font directories by default.
com.aspose.pdf.Document.restoreLocalFontPath();
Please feel free to contact us for any further assistance.
Best Regards,
The issues you have found earlier (filed as PDFNEWJAVA-33946) have been fixed in Aspose.Pdf for Java 4.5.1.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.