PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 5:41 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: Thu Dec 07, 2023 4:35 am 
Offline

Joined: Thu Dec 07, 2023 4:09 am
Posts: 1
Hi everyone,

I'm in a bit of a conundrum at the moment with PdfSharpCore and MigraDocCore.

I'm trying to create a PDF service that may require the usage of multiple paragraphs that will vary in height due to varying text input length.

Due to MigraDocCore needing me to call "RenderObject" which requires a Y-axis value in order to work, I believe that I need to find a way to programmatically position each paragraph underneath each other to avoid overlap/be able to dynamically adjust positioning due to varying provided text length.

I am currently trying to calculate this via getting the previous paragraphs layout information, via the "GetRenderInfoFromPage" method and then
calculating a "Y-axis" position by adding the previous paragraphs "LayoutInfo.ContentArea.Y.Presentation" and "LayoutInfo.ContentArea.Height.Presentation" together. I provide that to the MigraDocCore renderer "RenderObject" method as the Y-axis value.

I thought that the Y position and the height of the previous paragraphs would result in the next render point would be the bottom of the previous paragraph at the very least. However if a paragraph has a few "\n" the next paragraph would be rendered only toward the bottom of the first paragrah.
Attachment:
File comment: This snip shows the overlap - the second paragraph is overlapping the bottom of the first paragraph
ParagraphOverlap.PNG
ParagraphOverlap.PNG [ 40.65 KiB | Viewed 6605 times ]


I am aware of the "SpaceBefore" and "SpaceAfter" properties on paragraphs, however those are irrelevant due to the required usage of "RenderObject" which requires a Y-axis value.

TLDR:
Has anyone figured out a way to programmatically position paragraphs underneath each other with PdfSharpCore and MigraDocCore?

Thanks so much for any help


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 07, 2023 8:41 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 916
Location: CCAA
matt_pdf wrote:
I'm in a bit of a conundrum at the moment with PdfSharpCore and MigraDocCore.
We do not support those libraries here.
Feel free to try our libraries.

When using RenderObject, you are fully responsible for object positions and it is up to your to code to prevent overlapping.

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


Top
 Profile  
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 374 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