PDFsharp 1.2.1269.0;
MigraDoc 1.2.2546.0;
Visual Studio 2008 SP1;
Windows Vista 32-bit;
1. Open the GDI+ MixMigraDocAndPdfSharp project;
2. After line 88 (doc.AddSection), add the following:
Code:
sec.PageSetup.PageWidth = Unit.FromCentimeter(12);
sec.PageSetup.PageHeight = Unit.FromCentimeter(1);
sec.PageSetup.TopMargin = Unit.Zero;
sec.PageSetup.BottomMargin = Unit.Zero;
sec.PageSetup.LeftMargin = Unit.Zero;
sec.PageSetup.RightMargin = Unit.Zero;
3. Run the project;
On my system, the project hangs on the call to PrepareDocument, with very high CPU and memory usage. It seems to be stuck in an infinite loop within the TopDownFormatter.FormatOnAreas method.
I encountered this in a project where I'm trying to use MigraDoc to draw a series of formatted paragraphs onto an existing PDF document within a specific block. The text is entered by the end-user, so I have no way of determining the required height.
If I remove the height from the page setup, the text is rendered incorrectly. As a workaround, I have had to set the height to a large multiple of the height of the block, and hope that the text will never exceed this height.