We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Need help in error

Hello,

Your support seems offline, one of the team member said he has waited for 3 hours, and no reply from Aspose support. hope you will be able to assist further.


Here’s the error details:

2015-11-06 08:32:19,284 ERROR [com.efinancialcareers.myefc.rf.processors.aspose.AsposeResumeConverterProcessor] - Unexpected exception {}
java.lang.NullPointerException
at com.aspose.pdf.internal.p48.z29.m27(Unknown Source)
at com.aspose.pdf.internal.p37.z1.m1(Unknown Source)
at com.aspose.pdf.internal.p37.z5.m1(Unknown Source)
at com.aspose.pdf.internal.p27.z7.m3(Unknown Source)
at com.aspose.pdf.internal.p27.z7.m4(Unknown Source)
at com.aspose.pdf.internal.p27.z7.m2(Unknown Source)
at com.aspose.pdf.internal.p27.z7.m2(Unknown Source)
at com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)
at com.aspose.pdf.z37.m1(Unknown Source)
at com.aspose.pdf.ADocument.save(Unknown Source)
at com.aspose.pdf.Document.save(Unknown Source)
at com.aspose.pdf.ADocument.save(Unknown Source)
at com.aspose.pdf.Document.save(Unknown Source)
at com.efinancialcareers.myefc.rp.aspose.converters.PdfAsposeConverterImpl.toHtml(PdfAsposeConverterImpl.java:108)
at com.efinancialcareers.myefc.rp.aspose.AsposeResumeConverterServiceImpl.convertToHtml(AsposeResumeConverterServiceImpl.java:28)
at com.efinancialcareers.myefc.rf.processors.aspose.AsposeResumeConverterAdapterImpl.convertToHtml(AsposeResumeConverterAdapterImpl.java:24)
at com.efinancialcareers.myefc.rf.processors.aspose.AsposeResumeConverterProcessor.process(AsposeResumeConverterProcessor.java:60)
at com.efinancialcareers.myefc.rf.BaseResumeProcessor$2.call(BaseResumeProcessor.java:344)
at com.efinancialcareers.myefc.rf.BaseResumeProcessor$2.call(BaseResumeProcessor.java:335)
at com.efinancialcareers.myefc.rf.BaseResumeProcessor.runInTransaction(BaseResumeProcessor.java:319)
at com.efinancialcareers.myefc.rf.BaseResumeProcessor.processInsideTransaction(BaseResumeProcessor.java:335)
at com.efinancialcareers.myefc.rf.BaseResumeProcessor.processMessage(BaseResumeProcessor.java:149)
at com.efinancialcareers.myefc.rf.BaseResumeProcessor.onMessage(BaseResumeProcessor.java:94)
at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:330)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:537)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:497)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1096)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1088)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:985)
at java.lang.Thread.run(Thread.java:745)

Hi,


Thanks for your inquiry.

Our apologies about the wait however our support team is currently on a publicly observed holiday. Your request is in the right place and they will answer it as soon as they return. Thank you for your patience.

Thanks,

Thanks for reply. Can you give me an idea on when we will be able to get an answer to the above issue? If you can tell me when the public holiday until?


Thanks

Hi,


The support team are back today and will reply to your request shortly.

Thanks,

Hi,



Thanks for contacting support and sorry for the delayed response.



Please share some details regarding the requirement you are trying to accomplish using our API and also please share some resources (code snippet and input resource files) which can help us in replicating this issue in our environment. We are sorry for this inconvenience.

Hello,


Please find the attached sample document to convert

Here is the codes snippet:

 Document pdfDocument = new Document(sourceFilePath);
pdfDocument.save(sourceFilePath + “.html”, SaveFormat.Html);

Hi,


Thanks for sharing the resource file.

I have tested the scenario using Aspose.Pdf for Java 10.8.0 in Eclipse Juno project with JDK 1.7 running over Windows 7 (x64) and as per my observations, no exception/issue is appearing. Can you please share some details regarding your working environment. We are sorry for this inconvenience.

For your reference, I have also attached the output generated over my end.

Hello,


We are running java 1.7.0_55 over Linux x64. Please note that NPE is thrown when we run PDF to HTML conversion for the second and subsequent times. Please let us know if more details are needed.

Thanks!

Hi,


Thanks for sharing the details.

We are testing the scenario on Linux environment and will get back to you soon. We are sorry for this inconvenience.

Hello, any update yet?


Thanks

Hi,


Thanks for your patience.

We are still in the process of setting up Linux environment so that we can try replicating the issue in our environment. As soon as we have some further updates, we will let you know.

Hello!

We have tried to change properties of saving according to documentation: https://docs.aspose.com/pdf/java/convert-pdf-to-html-format/#inspdf-to-html—single-html-with-all-resources-embedded

We don’t get error on windows machine, but we manage to get it on linux machine even with new saving options and new file.

Please find the other attached sample document (SamplePdf.pdf) and the other code snippet:

pdfDocument = new Document(sourceFilePath);
HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.Html);
saveOptions.setFixedLayout(true);
saveOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
saveOptions.LettersPositioningMethod =
LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
saveOptions.RasterImagesSavingMode =
HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
saveOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats;
pdfDocument.save(sourceFilePath + HTML_EXTENSION, saveOptions);
P.S. We use aspose-pdf 10.6.2

Thanks

Hi,

We use the following:
Document pdfDocument = new Document(sourceFilePath);

pdfDocument.save(sourceFilePath + “.html”, SaveFormat.Html);



Please also try the file attached on example that we get the error

Please let us know if you have an update?


Thanks

Hi,


Thanks for sharing the details and sorry for the delayed response.

The NullPointerException usually occurs when you try to transform PDF file to other file format i.e. HTML, DOC etc and the fonts used in PDF document are missing on target machine (where the conversion is being performed). However before we suggest you setting custom font path, we need to test the scenario and be certain of the reasons causing this issue. We will surely update you with our findings, shortly.

Just for your reference, please note that you can use following methods to get fonts folder over system folder or set font path to font folders.
  • Document.getLocalFontPath () - shows the system folder in which project will look for fonts.
  • Document.setLocalFontPath (String) - Setting font path to custom folder

// Set font folder path
String path = “/usr/share/fonts/truetype/msttcorefonts/”;
// Adding a single font directory
// com.aspose.pdf.Document.addLocalFontPath(path);

// setting the user list for standard font directories
java.util.List list = com.aspose.pdf.Document.getLocalFontPaths();
list.add(path);


We are really sorry for this delay and inconvenience.

Hello,


Any update on the investigation outcome above?

These are the fonts we figured Aspose is calling
[ %WINDIR%/Fonts/, /usr/openwin/lib/X11/fonts/TrueType/, /usr/local/share/fonts/, $home/.fonts/, /usr/share/fonts/truetype/, /usr/X11R6/lib/X11/fonts/ttfonts/, /Library/Fonts/, ~/Library/Fonts/, /Network/Library/Fonts/, /System/Library/Fonts/, ~/.fonts/, /usr/share/fonts/, /usr/share/X11/fonts/TTF/, /system/fonts/ ]


Thanks

Hi.


SO I checked the locations in the lookup paths and also the defaults specified in this documentation: http://www.aspose.com/docs/display/wordsnet/How+to++Specify+True+Type+Fonts+Location

and established that we have no fonts in the default locations.

So I would like to ask for 2 things from you @aspose support:

1) How to specify where to look for fonts for all input or output documents
2) How to specify the default font if a search for a font of any type fails (ideally thus if a specific font is not found then we would still complete the transformation and set a default font to use as a failsafe)?

thx

Hi,



Thanks for sharing the details. During my testing, I have observed that all the documents shared in this thread are zero bytes and they appear to be broken. Can you please double check at your end.

File as attached

Can you please respond to my questions too about specifying a default font and font locations:


Hi.

SO I checked the locations in the lookup paths and also the defaults specified in this documentation: http://www.aspose.com/docs/display/wordsnet/How+to++Specify+True+Type+Fonts+Location

and established that we have no fonts in the default locations.

So I would like to ask for 2 things from you @aspose support:

1) How to specify where to look for fonts for all input or output documents
2) How to specify the default font if a search for a font of any type fails (ideally thus if a specific font is not found then we would still complete the transformation and set a default font to use as a failsafe)?

thx

efcdev:
1) How to specify where to look for fonts for all input or output documents
Hi,

In order to get the current font folder over system, you need to use Document.getLocalFontPath () - shows the system folder in which project will look for fonts.
efcdev:
2) How to specify the default font if a search for a font of any type fails (ideally thus if a specific font is not found then we would still complete the transformation and set a default font to use as a failsafe)?
You can specify the font path where required fonts can be found and currently you cannot specify a default font which can be used, if required fonts are found missing over system. However I will discuss this requirement with product team and will let you know. We are sorry for this inconvenience.