PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Apr 25, 2024 4:35 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Feb 06, 2015 4:53 pm 
Offline

Joined: Fri Feb 06, 2015 4:46 pm
Posts: 3
Using Migradoc, I would like to have a paragraph that takes up a minimum amount of vertical space. Maybe a maximum too but that's a separate issue. Ideally I would like to set it up so that it will add whatever padding/margin is necessary to take up that space given the text in the paragraph. Failing that, can I measure the height of the paragraph after setting the text and then add space?

I don't remember if I have the GDI or WPF DLL, and I don't see any version information. Is there a way to find that info?


Last edited by nscherer on Sat Feb 07, 2015 6:29 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 07, 2015 6:27 am 
Offline
PDFsharp Expert
User avatar

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

Welcome to the forum.

Please read this post:
viewtopic.php?f=2&t=832

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


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 09, 2015 9:01 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
nscherer wrote:
I don't remember if I have the GDI or WPF DLL, and I don't see any version information. Is there a way to find that info?
Tell us the name of the DLL. Look at its properties (right click in Explorer).

One possible solution: use tables. One row, one column, no visible borders. You can set the height of the row. For debugging you can show the borders.

Later on you can use PDFsharp functions to detect how much space the text will need and truncate the text as needed.

Or don't set the height of the row, instead add a second column with an empty paragraph - using the ParagraphFormat.LineSpacingRule and ParagraphFormat.LineSpacing you can set a minimum height. The row will grow if your text is too long.

Or use TextFrames at absolute positions.

Maybe there are other solutions if you tell us more about what you want to achieve.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 09, 2015 4:50 pm 
Offline

Joined: Fri Feb 06, 2015 4:46 pm
Posts: 3
Thomas Hoevel wrote:
Tell us the name of the DLL. Look at its properties (right click in Explorer).


MigraDoc.DocumentObjectModel.dll

File version 1.32.3885.0

Thomas Hoevel wrote:
Later on you can use PDFsharp functions to detect how much space the text will need and truncate the text as needed.


Yeah, I will need to cross that bridge at some point too. I did see some answers about truncating text that's too long so I may be able to figure that one out.

Thomas Hoevel wrote:
Or don't set the height of the row, instead add a second column with an empty paragraph - using the ParagraphFormat.LineSpacingRule and ParagraphFormat.LineSpacing you can set a minimum height. The row will grow if your text is too long.


That sounds interesting, but I'm not quite following how that would work. LineSpacing controls how much space is between paragraphs, right? I'm looking for a minimum height of the paragraph, including its content. Could this technique achieve that?

Thomas Hoevel wrote:
Or use TextFrames at absolute positions.


Can a TextFrame have an absolute height but a relative position? I only ask because I've found absolute positioning to be a pain (not in Migradoc specifically just in general). I think I could make that work though.

Thomas Hoevel wrote:
Maybe there are other solutions if you tell us more about what you want to achieve.


I've attached a screen shot of what this part of the document is supposed to look like. The "notes" part should be a minimum height so there is room to write on it, with the status below, and a box around both. Right now I have them in the same paragraph with a border on the paragraph.

Thanks for your help!


Attachments:
File comment: Screen shot of the relevant part of the document
wf_pdf_notes.png
wf_pdf_notes.png [ 4.99 KiB | Viewed 7215 times ]
Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 10, 2015 9:03 pm 
Offline

Joined: Fri Feb 06, 2015 4:46 pm
Posts: 3
I made it work with a TextFrame, though I moved the "status" field above the frame and used the frame for just the notes.


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 330 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