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

Free Support Forum - aspose.com

Taking the content of PDF from a XML or HTML File

Hi,

I want the content of the PDF to be fetched from a XML file or a html file, is that possible in Aspose.pdf (I am Using version 1.0). The content I want to be displayed in the PDF include text and images.

Any help is appreciable.

Thanks and Regards

Hello Aparna,

Thanks for your interest in our products.

I am pleased to inform you that Aspose.Pdf for .NET supports the feature to convert XML as well as HTML contents into PDF format. Please visit the following links for more information on


Please try using the latest release version of Aspose.Pdf for .NET 6.0.0. In event of any further query, please feel free to contact.

Hi,

Thanks for the information, but its giving the error that type Aspose.Pdf.Generator.Pdf is not defined,

Is it because we are using Aspose.pdf version 1.0.?

Kindly help what to do now.

Thanks

Hi

Little update on above, we are using Aspose.pdf version 2.1.

Thanks.

Hello Aparna,

The version of Aspose.Pdf for .NET that you are using is quite old and there have been numerous changes till the release of latest release version of Aspose.Pdf for .NET 6.0.0. Please download the latest release version from this link and try using it. I hope the code will work. More along, I would suggest you to please visit the following links for better understanding on


In the event of any further query, please feel free to contact. We apologize for your inconvenience.

Hi,

Thanks for all your help, that was really help, now I am able to convert a XML file to PDF,

but I am still facing problem for convrting HTML to PDF, I used the same sample code as provided by you, but its throwing an exception (Invalid type cast), PFA the screenshot where this exception is thrown, this exception is thrown where we are saving the file using pdf.save() function.

kindly look into this and suggest what to do.

Hello Aparna,

Thanks for using our products.

Can you please share the source HTML so that we can test the scenario at our end. We apologize for your inconvenience.

Hi,

I got the earlier code working, but now when I am trying to add a background image (here I am not using the tag in the html file) The background image is not getting displayed in the PDF file, though the data on it is getting displayed in the PDF.

I am attaching here both the ASPX (example.txt) and HTML(t6.txt) file,

kindly suggest what to do now.

Thanks in Regards

Hello Aparna,<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>

I
have tested the scenario and I am able to notice that background image specified in DIV tag is not being displayed in resultant PDF. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-29978. We will investigate this
issue in details and will keep you updated on the status of a correction.<span style=“font-size:10.0pt;
font-family:“Arial”,“sans-serif””>

We apologize for your inconvenience.