Hi,
these are my first Steps in Creating an PDF with VB.NET. I think I have some Problems with Understanding the whole Thing, so please be patient.
I have an PDF, which is an Template (only 1 Image as a Background) "back.pdf". I open this as a new pdfDocument and "select" Page(0). Now I try to write something at a specific point of the Document.
But nearly all Tries failed.
So, I copied a snipet from the PDFSharp-Wiki (
Under First Page) and I get an Error "the --Operator is not defined for XUnit and Integer" (I have the german Version, so I have to translate - I hope I got it!).
Here is my Code:
Code:
Private Sub PdfFuellen()
Dim pdf As PdfDocument = New PdfDocument()
Dim Ausgabe As String = ""
pdf = PdfReader.Open("Gfx\back.pdf")
Dim pdfPage As PdfPage = pdf.Pages(0)
Dim graph As XGraphics = XGraphics.FromPdfPage(pdfPage)
Dim font As XFont = New XFont("Andalus", 30, XFontStyle.Regular)
Ausgabe = "something"
graph.DrawString(Ausgabe, font, XBrushes.Black, New XRect((100, 100, --> pdfPage.Width - 200 <--, 300), XStringFormats.Center)
Dim pdfFilename As String = "firstpage.pdf"
pdf.Save(pdfFilename)
Process.Start(pdfFilename)
End Sub
I marked the Error with "--> <--".
Could you please help me? What went wrong?
Thx in advance
Michael
[EDIT] The PageSize of this Document is A5 and Landscape. And I use the newest Version of PDFSharp 1.50.4845-rc2a (from nuget.org) - yesterday downloaded and installed.