PDFsharp & MigraDoc Forum
https://forum.pdfsharp.net/

Measure a paragraph's height
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3516
Page 1 of 1

Author:  ronnyek [ Mon Dec 19, 2016 4:01 am ]
Post subject:  Measure a paragraph's height

With migradoc does there exist anything that will help me understand how much space a paragraph is taking up? I've got a scenario where I have some text and I need to resize an image to reasonably fit in the remaining space on a page.

I found routines that would do this... but required xgraphics and straight pdfsharp. Im assuming migradoc rendering has to know when to draw page headers and footers and such... you'd have to be able to measure the height of paragraphs etc.

Any guidance here would be helpful.

Author:  TH-Soft [ Mon Dec 19, 2016 6:34 pm ]
Post subject:  Re: Measure a paragraph's height

Hi!

MigraDoc determines sizes and positions when the PdfDocumentRenderer prepares the document.
With PDFsharp 1.50 you can easily access the positions and sizes of all items.

Then you can add the image using PDFsharp methods (XGraphics) or add the image using MigraDoc methods and start the renderer again.

See also:
viewtopic.php?p=9694#p9694

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/