PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Tue Dec 09, 2025 6:59 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Oct 05, 2012 5:42 am 
Offline

Joined: Thu Oct 04, 2012 4:46 am
Posts: 10
I am new to this forum, but I am really liking migradoc's API. So far it seems like a great piece of software.

Thank you for all help while I go through teething problems.

I am creating a PDF with a list of drug doses, calculated according to a patients weight and age.

The header consists of 2 components -a paragraph containing the date the document was created, and 2 textframes sitting just below this paragraph (one to the left and one to the right of the page) - 1 to affix the patient identification sticker, and another for confirmation signatures, both added with:
Code:
Paragraph para = section.Headers.Primary.AddParagraph();
TextFrame ptSticker = section.Headers.Primary.AddTextFrame();

the issue is that while the paragraph component takes up physical space, so each pages content starts below this, the textframes are absolutely positioned (to use html terminology) and thus the textframe content completely overlaps the content added with
Code:
section.AddParagraph();

I could 'Hack' it, but what is a good solution to ensure each pages content starts below the iframe (including when content flows onto a new page and the header is repeated)

thank you


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 07, 2012 6:25 am 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 355
Hi!

Set page margins to take care of the reserved area at the top. PageSetup can be different for every section.
See this post showing how to set the bottom margin:
viewtopic.php?p=3085#p3085

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 07, 2012 10:17 am 
Offline

Joined: Thu Oct 04, 2012 4:46 am
Posts: 10
Thanks for your reply - By setting the page margin I am half way there in terms of - the page content begins below the left textframe. this textframe is appropriately positioned below the header paragraph above when using

ptSticker.RelativeVertical = RelativeVertical.Paragraph;

however, whether using RelativeVertical.Paragraph or RelativeVertical.Line, the right hand textframe begins with its top at the bottom margin of the left textframe (ie the previously defined element, which makes sense for the line option, but less so for the paragraph option).

If using RelativeVertical.Margins, of course the textframes are still overlapping the page content (just the textframes and page content are pushed lower down by specifying the greater PageSetup.TopMargin). If setting RelativeVertical.Page, the textframes are at the very top of the page (ie the edge of the paper), and if using relativeVertical.Page with enough top margin to clear the 1st header paragraph, the text moves down appropriately, but the textframe border remains steadfastly attached to the very top of the page (for those of us familiar with html it is like setting the padding grater than the element height with overflow visible)

Thanks for any help with this element alignment problem.


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 08, 2012 7:34 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3139
Location: Cologne, Germany
Hi!

When using RelativePage, set the position using textFrame.WrapFormat.DistanceTop as shown here:
viewtopic.php?p=6141#p6141

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 11, 2012 1:01 am 
Offline

Joined: Thu Oct 04, 2012 4:46 am
Posts: 10
Thank you very much - works beautifully


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 269 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