Free Support Forum -

pdf.BindXML not working on a WebServer

Public Function GetInvoice() As Pdf

Dim pdf As Pdf = New Pdf()
Dim xmlFile As String = path + "\\Xml\\Invoice.xml"
pdf.BindXML(xmlFile, Nothing)
Dim headerFooter As HeaderFooter = pdf.Sections(0).OddHeader
Dim logoImage As Image = CType(headerFooter.Paragraphs(0), Image)
logoImage.ImageInfo.File = path + "\\Images\\logo1.jpg"
logoImage.ImageScale = 0.74F

Dim Footer As HeaderFooter = pdf.Sections(0).OddFooter
Dim text As Aspose.Pdf.Text = CType(Footer.Paragraphs(0), Aspose.Pdf.Text)
Dim seg As Segment = text.Segments(0)
PutSearchString(pdf) ' to write a heading table
PutInvoice(pdf) ' to write the data table
Return pdf
End Function

Xml is as follows

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

Page $p of $P

One Portals Way,Twin Points WA 98156

Phone: 1-206-555-1417 Fax: 1-206-555-5938

This code is working fine on my local machine. But once I move to the web server, it is not working. I could locate it is happening because of pdf.BindXML(xmlFile, Nothing) statement and throws a security error.

Could any one please transalate the above code so that it can work without the xml file. I have to give a demo to the client urgently. Helping hands are highly appreciated. Forgive me for asking too much but I'm very new to aspose.pdf

Thanks in advance.

Here is the code to replace the xml:

pdf.Author = "Aspose Support"
pdf.Title = "Invoice"
pdf.Producer = "Aspose Pty Ltd"
pdf.Creator = "Aspose.Pdf.Demos"
pdf.Subject = "Northwind"
pdf.Keywords = "Pdf Aspose.Pdf Northwind"

Dim sec1 As Section = pdf.Sections.Add

sec1.ID = "section1"
sec1.PageInfo.Margin.Top = 140
sec1.PageInfo.Margin.Left = 50
sec1.PageInfo.Margin.Right = 50

Dim footer As HeaderFooter = New HeaderFooter
sec1.OddFooter = footer
sec1.EvenFooter = footer

Dim text1 As Text = New Text
text1.TextInfo.Alignment = AlignmentType.Center
Dim seg1 As Segment = text1.Segments.Add("Page $p of $P")
seg1.TextInfo.Color = New Color(0, 0, 160)
seg1.IsSymbolReplaceable = True

Dim header As HeaderFooter = New HeaderFooter
sec1.OddHeader = header
sec1.EvenHeader = header

Dim img1 As Image = New Image
img1.ImageInfo.ImageFileType = ImageFileType.Jpeg
img1.ID = "logo"
img1.Margin.Top = 30

Dim graph1 As Graph = New Graph(478, 10)

Dim pos As Single() = New Single() {0, 6, 478, 6}
Dim line1 As Line = New Line(pos)
line1.GraphInfo.LineWidth = 2
line1.GraphInfo.Color = New Color(0, 0, 160)

text1 = New Text
seg1 = text1.Segments.Add("One Portals Way,Twin Points WA 98156")
seg1.TextInfo.Color = New Color(0, 0, 160)
seg1.TextInfo.FontName = "Times-BoldItalic"
seg1.TextInfo.FontSize = 10

text1 = New Text
seg1 = text1.Segments.Add("Phone: 1-206-555-1417 Fax: 1-206-555-5938")
seg1.TextInfo.Color = New Color(0, 0, 160)
seg1.TextInfo.FontName = "Times-BoldItalic"
seg1.TextInfo.FontSize = 10

My web application was running under Asp.Net 1.0 . I have updated it to 1.1.

Now pdf report is working with pdf.BindXML

Thank you very much for your help.It is really appreciated. I was deeply in trouble.

Thanks Again.