PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Jul 03, 2020 7:06 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Jun 19, 2020 6:44 pm 
Offline

Joined: Fri Jun 19, 2020 6:39 pm
Posts: 2
Hallo
ik werk in vb.net met pdfsharp en wil een nieuwe pagina openen en daar verder op werken maar hij gaat door op de vorige pagina en niet op de nieuwe
Wat doe ik fout wat doe ik fout ????

Dim pdf As PdfDocument = New PdfDocument
Dim pdfPage As PdfPage = pdf.AddPage
Dim graph As XGraphics = XGraphics.FromPdfPage(pdfPage)
Dim font As XFont = New XFont("courier new", 11, XFontStyle.Regular)
pdf.Info.Title = "My First PDF"
'#################### afbeelding plaatsen
strBestand = LocatieFotos & "\brief_96dpi.jpg"
graph.DrawImage(System.Drawing.Bitmap.FromFile(strBestand), 10, 10, 575, 110)

strBestand = (LocatieFotos & "\knab_bank_rode_balk_facturen_96dpi.jpg")
graph.DrawImage(System.Drawing.Bitmap.FromFile(strBestand), 10, 785, 575, 20) ''links 10 , hoogte

''################## tekst plaatsen
graph.DrawString("1", font, XBrushes.Black, _
New XRect(400, 120, pdfPage.Width, pdfPage.Height), XStringFormats.TopLeft)

graph.DrawString("2", font, XBrushes.Black, _
New XRect(400, 135, pdfPage.Width, pdfPage.Height), XStringFormats.TopLeft)

graph.DrawString("3", font, XBrushes.Black, _
New XRect(400, 150, pdfPage.Width, pdfPage.Height), XStringFormats.TopLeft)

graph.DrawString("4", font, XBrushes.Black, _
New XRect(400, 165, pdfPage.Width, pdfPage.Height), XStringFormats.TopLeft)

'' ################# nieuwe pagina openen ###########################
pdf.AddPage()

graph.DrawString("tweede blad", font, XBrushes.Black, _
New XRect(150, 300, pdfPage.Width, pdfPage.Height), XStringFormats.TopLeft)


Dim pdfFilename As String = "C:\Users\kees\Dropbox\Fotos_Program_Woodart\Nieuwe PDF\De eerste PDF.pdf"
pdf.Save(pdfFilename)
pdf.Close()
Process.Start(pdfFilename)


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 22, 2020 12:18 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 545
Location: CCAA
You do not use the result of "pdf.AddPage()", so the second page is added but the drawing is still done on the first page.

Use the new page and a new XGraphics object for the new page:
Code:
graph.Dispose()
pdfPage = pdf.AddPage()
graph = XGraphics.FromPdfPage(pdfPage)

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 27, 2020 9:56 pm 
Offline

Joined: Fri Jun 19, 2020 6:39 pm
Posts: 2
klopt het werk mu
Bedant


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group