Hi am Using PDFSharp dll
to creates a Pdf file and to save the file in a Folder.
Ny Problem is that when i am passing a particular
string from textbox to the DrawString
the result is fine but when I am using
Database Values to show in the created
Pdf all the written values are overlapping in the same Place.
I mean I am just getting a black image in the Pdf File.
Below is the Code i am trying'
public sub create()
Dim document As PdfDocument = New PdfDocument
document.Info.Title = "testPdf"
' Create an empty page
Dim page As PdfPage = document.AddPage
' Get an XGraphics object for drawing
Dim gfx As XGraphics = XGraphics.FromPdfPage(page)
Dim font As XFont = New XFont("Verdana", 20, XFontStyle.Bold)
'Fetch Values from DataBase
Dim id As Integer = 0
Dim sd As New SqlDataAdapter("Select * from testTable", myCon.con)
Dim dt As New DataTable
sd.Fill(dt)
For i2 As Integer = 0 To dt.Rows.Count - 1
id = dt.Rows(i2).Item("ID")
gfx.DrawString("" & id & "", font, XBrushes.Black, New XRect(0, 0, page.Width.Point, page.Height.Point), XStringFormats.TopLeft)
Next
Dim filename As String = "test.pdf"
document.Save(filename)
End sub
I think am Missing something may be the loop.Please assist.Any Ideas