PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Height

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
tmiller_15



Joined: 07 Jun 2009
Posts: 4

PostPosted: Tue Jun 09, 2009 4:55 am    Post subject: Height Reply with quote

I hope someone can help as this is starting to drive me crazy.
I am mixing a pdf and migradoc together. I am creating a paragraph in the migra doc that can be really long and possibly run over several pages. However when I combine them both together the paragraph does not run on to a second page. I then need to be able to get the location of the end of the paragraph so that I can add some more info to the bottom of it. Please find my code below.

All help is very much appreciated.

Dim document As New PdfDocument
Dim page As New PdfPage
document.AddPage(page)
Dim ps As PageSize = PageSize.A4
page.Size = ps
Dim gfx As XGraphics = XGraphics.FromPdfPage(page)
Dim image As XImage
image = XImage.FromFile("I:\Documents\Work\Images\CCLogoReflectionLarge.png")
gfx.DrawImage(image, -16, 10, 128, 128)
Dim font As New XFont("Book Antiqua", 8, XFontStyle.Regular)
Dim text As String = "company"
Dim text2 As String = "Sustainability Pty Ltd"
gfx.DrawString(text, font, XBrushes.Black, 83, 21)
gfx.DrawString(text2, font, XBrushes.Black, 83, 34)
gfx.DrawString("PO Box", font, XBrushes.Black, 83, 47)
gfx.DrawString("Berowr", font, XBrushes.Black, 83, 60)
gfx.DrawString("Phone ", font, XBrushes.Black, 83, 73)
gfx.DrawString("Fax", font, XBrushes.Black, 83, 86)
gfx.DrawString("Email ", font, XBrushes.Black, 83, 99)
Dim font2 As New XFont("Book Antiqua", 28, XFontStyle.Regular)
gfx.DrawString("Project Induction Form", font2, XBrushes.Black, 297.5, 120, XStringFormats.Center)
Dim font3 As New XFont("Book Antiqua", 11, XFontStyle.Regular)

Dim doc As New Document
Dim sec As Section = doc.AddSection()

Dim table As Table = sec.AddTable()
table.Borders.Visible = False
table.Columns.Width = "6.93cm"
table.TopPadding = 3

Dim column As Column = table.AddColumn()
column.Format.Alignment = ParagraphAlignment.Left

column = table.AddColumn()
column.Format.Alignment = ParagraphAlignment.Center

column = table.AddColumn()
column.Format.Alignment = ParagraphAlignment.Right

Dim row As Row = table.AddRow()

row.Cells(0).AddParagraph("Project No: ")
row.Cells(1).AddParagraph("Project Name: ")
row.Cells(2).AddParagraph("Date: ")

row = table.AddRow()

row.Cells(0).AddParagraph("Given Names: ")
row.Cells(1).AddParagraph("Last Name: ")

row = table.AddRow()

row.Cells(0).AddParagraph("Day Time Contact No: ")
row.Cells(1).AddParagraph("After Hours Contact No: ")


row = table.AddRow()
row.Cells(0).AddParagraph("Next Of Kin: ")
row.Cells(1).AddParagraph("Next Of Contact No: ")

row = table.AddRow()
row.Cells(0).AddParagraph("Address: ")
row.Cells(1).AddParagraph("Suburb: ")
row.Cells(2).AddParagraph("State: ")

row = table.AddRow()
row.Cells(0).AddParagraph("Post Code: ")

row = table.AddRow()
row.Cells(0).AddParagraph("Company: ")
row.Cells(1).AddParagraph("Supervisor: ")

row = table.AddRow()
row.Cells(0).AddParagraph("Work Cover No: ")
row.Cells(1).AddParagraph("Work Cover Date: ")

Dim pen As New XPen(XColors.Black, 1.0)

gfx.DrawRectangle(pen, 0, 140, 595, 125)

gfx.DrawString("Discipline / Trade and brief explanation of work", font3, XBrushes.Black, 3, 278)

Dim par As Paragraph = sec.AddParagraph()
par.AddText("Computer Programer")
par.Format.Font.Name = "Book Antiqua"
par.Format.Font.Size = 10
par.Format.Font.Bold = False
par.AddLineBreak()
par.AddLineBreak()
par.AddText("This is the paragraph that can be realy long")

Dim docRenderer As MigraDoc.Rendering.DocumentRenderer = New DocumentRenderer(doc)
docRenderer.PrepareDocument()
docRenderer.RenderObject(gfx, XUnit.FromPoint(3), XUnit.FromPoint(140), "20cm", table)
docRenderer.RenderObject(gfx, XUnit.FromPoint(3), XUnit.FromPoint(285), "20cm", par)
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Tue Jun 09, 2009 8:11 am    Post subject: Reply with quote

At first glance I'd say you don't use anything that can't be done with MigraDoc - maybe except the Rectangle, but that can be drawn using the Border feature of MigraDoc.

Use MigraDoc to draw the text and the logo and let MigraDoc deal with pagebreaks etc.
You can still add XGraphics while creating the PDF document.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
tmiller_15



Joined: 07 Jun 2009
Posts: 4

PostPosted: Tue Jun 09, 2009 11:02 am    Post subject: Reply with quote

Hi thanks for the reply.

I am not sure on how do the first bit in migradoc any suggestions.
Is there any way that you can position things in migradoc like in pdfsharp? Also what do you mean you can still use xgraphics while creating the pdf?
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com