I have a PDF document that converts to PNG fine on Windows, but doesn’t work on Linux - it’s very slow, and doesn’t generate any text. I see that there are instructions for adding TrueType fonts for Aspose.Words, is there a similar procedure for Aspose.Pdf? I do have the dejavu font installed…
Would the missing fonts be the cause of the slowdown?
Here’s the stack trace where it always seems to always be stuck:
- java.util.HashMap.createEntry(int, java.lang.Object, java.lang.Object, int) @bci=15, line=897 (Compiled frame)
- java.util.HashMap.addEntry(int, java.lang.Object, java.lang.Object, int) @bci=65, line=884 (Compiled frame)
- java.util.HashMap.put(java.lang.Object, java.lang.Object) @bci=137, line=505 (Compiled frame)
- java.util.jar.Attributes.put(java.lang.Object, java.lang.Object) @bci=12, line=148 (Compiled frame)
- java.util.jar.Attributes.putValue(java.lang.String, java.lang.String) @bci=10, line=168 (Compiled frame)
- java.util.jar.Attributes.read(java.util.jar.Manifest$FastInputStream, byte[]) @bci=301, line=421 (Compiled frame)
- java.util.jar.Manifest.read(java.io.InputStream) @bci=291, line=251 (Compiled frame)
- sun.security.util.SignatureFileVerifier.processImpl(java.util.Hashtable, java.util.List) @bci=20, line=252 (Compiled frame)
- sun.security.util.SignatureFileVerifier.process(java.util.Hashtable, java.util.List) @bci=9, line=239 (Interpreted frame)
- java.util.jar.JarVerifier.processEntry(sun.security.util.ManifestEntryVerifier) @bci=387, line=317 (Interpreted frame)
- java.util.jar.JarVerifier.update(int, byte[], int, int, sun.security.util.ManifestEntryVerifier) @bci=39, line=228 (Compiled frame)
- java.util.jar.JarFile.initializeVerifier() @bci=143, line=348 (Compiled frame)
- java.util.jar.JarFile.getInputStream(java.util.zip.ZipEntry) @bci=25, line=415 (Interpreted frame)
- sun.net.www.protocol.jar.JarURLConnection.getInputStream() @bci=88, line=162 (Interpreted frame)
- java.net.URL.openStream() @bci=4, line=1037 (Interpreted frame)
- org.apache.catalina.loader.WebappClassLoader.findLoadedResource(java.lang.String) @bci=47, line=2689 (Interpreted frame)
- org.apache.catalina.loader.WebappClassLoader.getResourceAsStream(java.lang.String) @bci=47, line=1101 (Interpreted frame)
- com.aspose.pdf.internal.p437.z16.m2(java.lang.String) @bci=14 (Compiled frame)
- com.aspose.pdf.internal.p437.z16.m9() @bci=454 (Interpreted frame)
- com.aspose.pdf.internal.p437.z16.m8() @bci=15 (Interpreted frame)
- com.aspose.pdf.internal.p437.z16.m7() @bci=8 (Interpreted frame)
- com.aspose.pdf.internal.p437.z16.m1() @bci=19 (Interpreted frame)
- com.aspose.pdf.internal.p437.z29.m9() @bci=93 (Interpreted frame)
- com.aspose.pdf.internal.p437.z29.m16() @bci=1 (Interpreted frame)
- com.aspose.pdf.internal.p427.z3.m1(com.aspose.pdf.internal.p413.z4) @bci=11 (Interpreted frame)
- com.aspose.pdf.internal.p416.z40.m2(com.aspose.pdf.internal.p413.z4) @bci=2 (Interpreted frame)
- com.aspose.pdf.internal.p416.z40.m4(com.aspose.pdf.internal.p413.z4) @bci=14 (Interpreted frame)
- com.aspose.pdf.internal.p416.z13.m2(com.aspose.pdf.internal.p413.z4, com.aspose.pdf.internal.p236.z17) @bci=89 (Interpreted frame)
- com.aspose.pdf.internal.p416.z13.m1(com.aspose.pdf.internal.p395.z6, com.aspose.pdf.internal.p399.z11, com.aspose.pdf.internal.p489.z13, com.aspose.pdf.internal.p413.z4[]) @bci=73 (Interpreted frame)
- com.aspose.pdf.devices.z4.m1(com.aspose.pdf.internal.p413.z4[]) @bci=758 (Interpreted frame)
- com.aspose.pdf.devices.z4.m1() @bci=13 (Interpreted frame)
- com.aspose.pdf.devices.ImageDevice.m1(com.aspose.pdf.Page) @bci=56 (Interpreted frame)
- com.aspose.pdf.devices.PngDevice.processInternal(com.aspose.pdf.Page, com.aspose.pdf.internal.p249.z41) @bci=2 (Interpreted frame)
- com.aspose.pdf.devices.PngDevice.process(com.aspose.pdf.Page, java.io.OutputStream) @bci=11 (Interpreted frame)
Hi Tom,
Document.setLocalFontPath (String) - Setting font path to custom folder
//adding a new font path<o:p></o:p>
String path = “c:\fonts\”;<o:p></o:p>
com.aspose.pdf.Document.addLocalFontPath(path);<o:p></o:p>
Moreover please also check following code snippet to set font path if there are more than one font path.
//geting the list for standard font directories in different OS<o:p></o:p>
java.util.List list = com.aspose.pdf.Document.getLocalFontPaths();<o:p></o:p>
//seting the user list for standard font directories<o:p></o:p>
list.add(“c:\fonts2\”);<o:p></o:p>
list.add(“c:\fonts3\”);<o:p></o:p>
com.aspose.pdf.Document.setLocalFontPaths(list);<o:p></o:p>
//Restoring list for standard font directories by default.<o:p></o:p>
com.aspose.pdf.Document.restoreLocalFontPath();<o:p></o:p>
<o:p> </o:p>
<o:p>Please feel free to contact us for any further assistance.</o:p>
<o:p>
</o:p>
<o:p>Best Regards,</o:p>
Thanks for your reply. I have one follow-up question:
If the TrueType fonts are not available on Linux, then Aspose will need to do extra work to make do with what it can find. Is any of this work cached? In other words, will processing speed always be slower for 10 documents that contain TT font “X”, and if so, by about how much?
Hi Tom,
Hi Tom,
for(FontSource source :
(Iterable<FontSource>) FontRepository.getSources())<o:p></o:p>
{
if (source instanceof SystemFontSource)
{
System.out.println("Fonts count:"+((SystemFontSource)source).getFontDefinitions().length);
}
}
Please feel free to contact us for any further assistance.
Best Regards,