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

Infinite endless Loop in Migradoc TopDownFormatter.cs
https://forum.pdfsharp.net/viewtopic.php?f=3&t=2844
Page 1 of 1

Author:  peter4u [ Wed Jun 25, 2014 3:51 pm ]
Post subject:  Infinite endless Loop in Migradoc TopDownFormatter.cs

Steps to reproduce a infinite Loop in Migradoc TopDownFormatter.cs,
Function: FormatOnAreas(...),
Code Block:
Code:
while (!ready && area != null)
{
   ...
}

- Add a Image with width 150mm
- Add some (8) Text Items with one character

Code to reproduce the behaviour:

Code:

                Document document = new Document();

                var p = document.AddSection().AddParagraph();
                var i = p.AddImage("C:\\Temp\\150.png");

                double width;
                width = 140; // Works
                width = 150; // ***** LOOP ****
                //width = 170; // Works

                i.Width = Unit.FromMillimeter(width);
                p.AddText("a");
                p.AddText("a");
                p.AddText("a");
                p.AddText("a");
                p.AddText("a");
                p.AddText("a");
                p.AddText("a");
                p.AddText("a");

                PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false, PdfFontEmbedding.Always);
                pdfRenderer.Document = document;
                pdfRenderer.RenderDocument();
                MemoryStream stream = new MemoryStream();
                pdfRenderer.PdfDocument.Save(stream, false);
                pdfcontent.Content = stream.ToArray();
                stream.Close();


Best regards
Peter

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