Demo for ImportXml method

Hi,

I have downloaded the Aspose Demos for ImportXml and it worked perfectly fine if I used the example files but it did not import any data onto my template of PDF. I created the xml file myself to follow the example xml file. Would you kindly advise me to fix the template setting so that I can import data from my xml file?

**The code I used:*********************************************************

Case "ImportXml" //Select statemen in the KitDemo(default) class
templatePdf = "C:\student.pdf"
Dim xml As String = "C:\student.xml"
Response.AddHeader("content-disposition", "inline; filename=" + "studentOut.pdf")
Response.ContentType = "application/pdf"
FormDemos.ImportXml(templatePdf, xml, Response.OutputStream)
Response.End()
Exit Sub

Public Shared Sub ImportXml(ByVal templatePdf As String, ByVal xml As String, ByVal outputStream As System.IO.Stream) // a function in the FormDemos Class, will be called in the KitDemo class
'Assign an input pdf file.
Dim form As Form = New Form(templatePdf, outputStream)

'Open an existed fdf file.
Dim xmlInputStream As System.IO.FileStream = New FileStream(xml, FileMode.Open)

'Export all the pdf fields' value into the fdf file.
form.ImportXml(xmlInputStream)

form.Save()

xmlInputStream.Close()

End Sub

***************************************************************************

Attached are the files I replaced with:

PDF file: F21.pdf

Xml file: F21xml_Fromdatabase

Thanks in advance!

Mikan

Hi Mikan,

I’m sorry for the late reply, but we’re still looking into the problem. You’ll be updated with the resolution the earliest possible.

We’re sorry for the inconvenience.
Regards,

Hi Mikan,

I have tested the issue at my end and couldn’t find any problem. In fact, the XML was imported successfully into the PDF file. The code snippet I have used is as under:



'Assign an input pdf file.

Dim form As Form = New Form(“F21.pdf”, “F21_output.pdf”)


'
Open an existed fdf file.

Dim xmlInputStream As System.IO.FileStream = New FileStream(“F21xml_Fromdatabase.xml”, FileMode.Open)

'import XML stream

form.ImportXml(xmlInputStream)

form.Save()

xmlInputStream.Close()

I have also attached the output PDF file. I would like to add that I have used the latest version of Aspose.Pdf.Kit; you can download Aspose.Pdf.Kit 3.5.0.0, if you're not already using it.

Please try this code snippet at your end. If problem persists then please do let us know.
Regards,

Hi Shahzad,

Thanks for your quick reply. I have downloaded the latest version and tried the code snippet you indicated and it worked without problem. I appreciate your help!

Mikan