Unsupported Element When Render using a Partial View

I am currently rendering the HTML code below but I keep on getting unsupported element Section when method BindXML is called.


pdf.BindXML(ms, null);

<Pdf xmlns=“Aspose.Pdf” DestinationType=“FitPage”>
    <Section>
<Text Alignment=“Center”><Segment>Hello</Segment></Text>
</Section>
</Pdf>
This can be resolved by including xmlns in all elements but I can’t do that since I will be rendering a grid with lots of elements inside it.
<pdf xmlns=“Aspose.Pdf” destinationtype=“FitPage”>
<section xmlns=“Aspose.Pdf”>
<text xmlns=“Aspose.Pdf” alignment=“Center”><segment xmlns=“Aspose.Pdf”>Hello</segment></text>
</section>
</pdf>
Any ideas on how to reflect xmlns in all child nodes automatically?

Hi Ronaldo,


Thanks for your inquiry. Please note you need to specify namespace in root element only instead each element. I have tested your share XML and unable to notice any exception. Please download and try latest version of Aspose.Pdf for .NET, hopefully it will resolve the issue. If the issue persist then please share some more details, so we will look into it accordingly.

Moreover, please note Aspose.Pdf expect XML compliant to Aspose.Pdf XSD schema. Please check this documentation link for details.

// Old Generator

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

pdf.BindXML(myDir+"test.xml",null);

pdf.Save(myDir + "test_OldGenerator.pdf");

// New DOM

Document pdfDocument = new Document(myDir+"test.xml", new XmlLoadOptions());

//pdfDocument.BindXml("E:/Data/testxml.xml");

pdfDocument.Save(myDir + "test_DOM.pdf");

Please feel free to contact us for any further assistance.


Best Regards,

Installing Aspose PDF via nuget did the trick! Thanks. However, when I render a partial view inside the , I get the unsupported exception again but for the DIV element.

Here is the sample project [link] that can reproduce the issue.

Hi Ronaldo,


Thanks for sharing the sample document. We are looking into it and will update you soon.

Best Regards,

Hi Ronaldo,


We are sorry for the delayed response. After initial investigation, we have logged a ticket PDFNEWNET-39385 for further investigation and rectification. We will keep you updated about the issue resolution progress.

Best Regards,