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 [ 40.65 KiB | Viewed 8552 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