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

Free Support Forum - aspose.com

Html to Pdf - Broken Image

Hi,

We are trialling your html to pdf conversion software and have a problem, I have an HTML document that references a file that does not exist and it falls over with the following error 'Invalid image file type for image', I was hoping that it would ignore files that it could not find and carry on. Is there a work round this problem?

Aspose.pdf.pdf pdf = new Aspose.Pdf.Pdf();

pdf.BindHTML ("c:\\webpage.html");

pdf.Save("c:\\PDF\\aspose.pdf");

Regards

Andy

Hello Andy,

Thanks for considering Aspose.

I have tested the scenario at my end and i am unable to re-produce the error. I am afraid why you are facing this problem. Can you please explain the complete scenario. Also can you tell us which version of Aspose.Pdf you are using.

Hi Nayyer,

Thanks for your reply, the version we are using is 3.6.2.0.

The issue is where the src for the image has no extension, for example.

notFound

When this happens the dll throws the exception I previously mentioned and writes a 0 byte pdf file. Hope this helps.

Thanks

Andy

Hello Andy,

I have tested the scenario and have been able to generate the issue but i don't think its an issue with Aspose.pdf component. its just a simple file handling issue, Aspose.Pdf parser could not determine what is the type of the source file. You can even see the same issue, if you provide name of any file other than image type in IMG SRC tag.

Can you please share with us what is your requirement for using it in such way.

Hello Nayyer,

Thanks for your response.

We do not have control over the Html we receive and stripping out these invalid SCR's is not an option for us and we will probably get more of the same problems in the future.

Would it not be possible to treat an invalid SRC as if the file does not exist and just ignore it rather than fail with an exception.

We have a requirements list that we use to evaluate products we are trailling with a view to purchassing the best , most reliable and with the best support, we think your product one of the best so far and we are extremley happy with the support you have shown us so todate.

Regards

Andy

Hi Andy,

I have logged this issue as PDFNET-5338. We will try to resolve it soon.

Hi,

I have another query that I would like to ask you, I have an html document which contains some Arabic text and when I convert to PDF it does not copy it very well, should it work with Arabic? and if it should could you please help me by telling we what I need to do?

Many Thanks

Andy

Hi Andy,

HTML containing Arabic text is not supported in the current version. We will investigate this issue and try to support it in the future version.

Hi Andy,

Now, we support Image name without extension. Please try our new release Aspose.Pdf 3.8.0.0.Thanks.

Best regards.