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

Free Support Forum - aspose.com

IsHtmlTagSupported

I am currently evaluating version 17.2 with the view to upgrading our Aspose Pdf from our current version of 3.8.


We make extensive use of XML templates and HTML text and I have run across a small problem that I need help with, if you would be so kind.

Consider the following XML fragment:

<?xml version="1.0" encoding="utf-8"?>
Test string

This gives the expected PDF with the text in Tahoma font of size 10pt.

Now consider the following XML:

<?xml version="1.0" encoding="utf-8"?>
Test string

This does not work as expected, the text seems to be in Times New Roman. Now reading prior posts I see that I have to use two other properties to get this to work, so consider the last XML:

<?xml version="1.0" encoding="utf-8"?>
<Text IsHtmlTagSupported=“true”
IfHtmlTagSupportedOverwriteHtmlFontNames=“true”
IfHtmlTagSupportedOverwriteHtmlFontSizes=“true”>
Test string

This gives me the error:

Unknown attribute in Text element. The attribute name is IfHtmlTagSupportedOverwriteHtmlFontNames.

My question is what am I doing wrong?

Thanks.

Hi Mark,


Thanks for contacting support.

Please note that you are trying to use XML structure which was supported by old Aspose.Pdf.Generator approach. Whereas it is strongly recommended to use new DOM (Document Object Model) approach. In DOM supported XML schema, a new element HtmlFragment has been introduced which can be used to display HTML supported text in the document.

Please check the following XML and code snippet to convert XML into PDF. I have modified your XML to following XML and used new DOM approach to convert it into PDF.

[XML]

<?xml version="1.0" encoding="utf-8" ?>
This is simple Text.
<![CDATA[
Test string
]]>

[C#]

Document doc = new Document();<o:p></o:p>

doc.BindXml(dataDir + “XML2PDF.xml”);<o:p></o:p>

doc.Save(dataDir + “XMLToPDF_out.pdf”);<span style=“font-size: 9.5pt; font-family: “Arial Narrow”, sans-serif;”><o:p></o:p>


For the reference I have also attached the generated output by above code. You may check the new approach in “Working with Aspose.Pdf” section of API documentation. In case if you need further assistance please feel free to contact us.


Best Regards,

Hi Asad,


Unfortunately, your documentation has very little information on using the DOM with XML, all the examples are for generating a PDF using code. Our system uses XML extensively and without knowing how to use the DOM equivalent of the “legacy” Aspose PDF Generator system, it is of little use.

Perhaps when you have updated your documentation so that this information is clearly available, then we may be in a position to utilise the DOM as you recommend.

For now, however, we will be staying with the “legacy” system.

Am I to understand from your reply that there is no “legacy” way of dealing with the problem I posted?

Thanks.
Mark

Hi Mark,


Thanks for your feedback.

I tried your shared XML to generate PDF with and was unable to generate the PDF using old legacy (Aspose.Pdf.Generator) approach. I am afraid that we cannot fix it in old legacy model as it is going to be obsolete soon and we are not providing support or resolving issues in this regard.

Moreover, I would like to share with you that the process of adding more XML based examples in the documentation
regarding new DOM approach is under process. I hope that you will get updated information about working with XML using new DOM approach in API documentation soon. In case of any further assistance please feel free to contact us. We are sorry for the inconvenience.

Best Regards,