PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon Nov 29, 2021 8:02 pm

All times are UTC

Forum rules

Please read this before posting on this forum: Forum Rules

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Nov 27, 2021 6:47 pm 

Joined: Sat Nov 27, 2021 6:25 pm
Posts: 1
So I'm using AddTabStop to align the second Text on the right side but there is something extra I want since the result its not the best

1. Set max width on the Left Text so in gets smaller, I know I can use RightIndent but then the right text wont go on the right position fully but stop in the Indent.
2. I simply want the right text to always Align on the Top also not in the bottom.
Check images below

I already have done this with drawlines but I had to recreate everything since new pages are not generated automatically. So I desiced to use PDFsharp & MigraDoc

The width is the PDF printer width but I think I have to calculate it different cause its bigger than the printers page width.
var s = section.AddParagraph(name, "Normal");
s.Format.TabStops.AddTabStop(width - 10, MigraDoc.DocumentObjectModel.TabAlignment.Center);

The one I created with drawline and MeasureString. But I have to rewrite everything to count for the new page generation. Maybe I can use it the document graphics with MigraDoc?

The one I made with MigraDoc I need to make it like the one I made with Drawlines

It also can help if you could tell me a method to know when to generate a new page.
The one I though is make stringbuilder and count each line with measure string. When the Y of the string position is higher than the page height and cant fit make a new page.
But to count each line when string doesnt fit I have to measure it again and again so I got to split it in lines.
Like how MigraDoc knows when to change the page? It measures the string like I thought of doing?

Reply with quote  
PostPosted: Mon Nov 29, 2021 8:20 am 
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 682
Location: CCAA

For PDFsharp: If you use the same style for all text then you can use the TextFormatterEx2 class to find page breaks.

If you use MigraDoc, consider using a table without visible borders. Left column for the text, right column for the amount.
Tab stops and line breaks do not work together.

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

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

All times are UTC

Who is online

Users browsing this forum: Google [Bot] and 18 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