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

Free Support Forum - aspose.com

Background image not visible on converting html to pdf

We are trying to convert html to pdf using aspose words in java. The background image is not not visible in the converted pdf.
We are using aspose words 19.12 version.

@Rashi_Bansal

Could you please ZIP and attach your input HTML, problematic and expected output PDF files here for testing? We will investigate this issue and provide you more information on it.

aspose.zip (14.1 KB)
Hello Tahir,
I have attached the html that we want to convert to pdf and the converted pdf. In the output pdf , the background image is expected which can be seen in the html.
Thanks.

@Rashi_Bansal

Please note that Aspose.Words mimics the behavior of MS Word. If you perform the same scenario using MS Word, you will get the same output.

So do we have any work around for this?
Actually we want to convert this html to image and initially we used aspose html to convert the html to image directly. But it gave null pointer exception in centOS and it took a lot of time in windows.
So as a work around, we converted the html to pdf using aspose words and then pdf to image using aspose pdf.
This took lesser time on windows in comparison to aspose html and aslo worked in centOS.

So please provide a solution to convert this html to image where we can see the background as well using any aspose java library which works on both windows and centOS.

For your reference, following is the error which we got using aspose html to convert html to image in centOS :
java.lang.NullPointerException
at com.aspose.html.internal.p226.z1.m1(Unknown Source)
at com.aspose.html.internal.p226.z1.m1(Unknown Source)
at com.aspose.html.internal.p202.z12.initialize(Unknown Source)
at com.aspose.html.internal.p202.z4.m3415(Unknown Source)
at com.aspose.html.internal.p202.z15.m2958(Unknown Source)
at com.aspose.html.internal.p202.z15.m1(Unknown Source)
at com.aspose.html.internal.p202.z15.m1(Unknown Source)
at com.aspose.html.internal.p202.z10.m1(Unknown Source)
at com.aspose.html.internal.p202.z10.m1(Unknown Source)
at com.aspose.html.internal.p202.z27.m1(Unknown Source)
at com.aspose.html.internal.p202.z27.m1(Unknown Source)
at com.aspose.html.internal.p202.z27.m1(Unknown Source)
at com.aspose.html.internal.p202.z27.m1(Unknown Source)
at com.aspose.html.internal.p202.z59.m1(Unknown Source)
at com.aspose.html.internal.p202.z2.m1(Unknown Source)
at com.aspose.html.internal.p202.z59.m1(Unknown Source)
at com.aspose.html.internal.p202.z59.m3(Unknown Source)
at com.aspose.html.internal.p202.z2.m1(Unknown Source)
at com.aspose.html.internal.p202.z59.m1(Unknown Source)
at com.aspose.html.internal.p202.z62.m3426(Unknown Source)
at com.aspose.html.internal.p153.z5.m2(Unknown Source)
at com.aspose.html.internal.p173.z10.m2868(Unknown Source)
at com.aspose.html.internal.p166.z2.m2(Unknown Source)
at com.aspose.html.internal.p166.z2.m2(Unknown Source)
at com.aspose.html.internal.p166.z2.m1(Unknown Source)
at com.aspose.html.internal.p151.z3.m1(Unknown Source)
at com.aspose.html.internal.p152.z1.m1(Unknown Source)
at com.aspose.html.internal.p257.z1.m1(Unknown Source)
at com.aspose.html.internal.p161.z4.m1(Unknown Source)
at com.aspose.html.internal.p161.z2.m5(Unknown Source)
at com.aspose.html.collections.z3.m126(Unknown Source)
at com.aspose.html.collections.z3.hasNext(Unknown Source)
at com.aspose.html.internal.p257.z1.m1(Unknown Source)
at com.aspose.html.rendering.HtmlRenderer.render(Unknown Source)
at com.aspose.html.rendering.HtmlRenderer.render(Unknown Source)
at com.aspose.html.rendering.Renderer.render(Unknown Source)
at com.aspose.html.rendering.Renderer.render(Unknown Source)
at com.aspose.html.converters.z5.m1(Unknown Source)
at com.aspose.html.converters.z5.m1(Unknown Source)
at com.aspose.html.converters.z5.m1(Unknown Source)
at com.aspose.html.converters.Converter.convertHTML(Unknown Source)

@Rashi_Bansal

You are using Aspose.HTML to convert HTML to PDF. So, we are moving this forum thread to respective forum where you will be guided appropriately.

@Rashi_Bansal

Would you kindly share the sample code snippet that you used to convert the HTML into Image? We will test the scenario in our environment and address it accordingly.

Hello Asad,
aspose (2).zip (6.0 KB)
Please find the attached zip. this contains the code snippet and the sample html.
We are trying to convert html to jpg. It is working fine in windows but it gives null pointer exception in centos (even a basic html containing h1 tag gives the error).
Even in the windows, the conversion is taking a lot of time.

PS: This is not replated to background image. We were facing the background image issue when we were using aspose words as a workaround.

@Rashi_Bansal

We need to further investigate this case in details. For the purpose, an investigation ticket as HTMLJAVA-1157 has been logged in our issue tracking system. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hello Asad
Can you please update me on this issue ?

@Rashi_Bansal

We are afraid that the earlier logged ticket has not been yet resolved. We will surely fix it on a first come first serve basis and let you know as soon as it is resolved. Please spare us some time.

We are sorry for the inconvenience.

Thanks for the update. Can you please share some rough timeline by when we can get this fixed so that we can plan this fix in our product release.

@Rashi_Bansal

We really regret that we cannot share any reliable or rough ETA at the moment as the ticket has not been fully investigated yet. Please note that the issues in free support model are resolved on first come first serve basis and their resolution time depends upon the number of issues in the queue. Nevertheless, we have recorded your concerns and will surely inform you once we have some update about ticket resolution or ETA. We highly appreciate your patience in this regard.

We apologize for the inconvenience caused.