Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overflowing paragraph text in TextFrame is not fully visible in end of page #36

Open
kobruleht opened this issue Oct 1, 2023 · 4 comments

Comments

@kobruleht
Copy link

kobruleht commented Oct 1, 2023

Expected Behavior

Last line in page should be fully visible (see attached pdf file).

Actual Behavior

Half of last line in end of first page is visible.

Steps to Reproduce the Behavior

Run attached solution

Code:

    static Document CreateDocument()
    {
        // Create a new MigraDoc document.
        var document = new Document { };
        // Add a section to the document.
        var section = document.AddSection();
        section.PageSetup.BottomMargin = 0;
        section.PageSetup.TopMargin = 0;
        for (int p = 1; p < 100; p++)
        {
            var textFrame = section.AddTextFrame();
            textFrame.RelativeVertical = RelativeVertical.Line;
            textFrame.WrapFormat.DistanceTop = Unit.FromCentimeter(0.11);
            textFrame.Height = Unit.FromCentimeter(0.47);
            var paragraph = textFrame.AddParagraph();
            paragraph.Format.Font.Name = "Times New Roman";
            paragraph.Format.Font.Size = 10;
            paragraph.AddText("Maksekorraldus 123456");
            paragraph.Format.SpaceBefore = 0;
            paragraph.Format.SpaceAfter = 0;
        }
        return document;
    }

texttruncatedinendofpage.zip
actual behaviour.pdf

Using PDFsharp-MigraDoc 6.0.0-preview-3

@TH-Soft
Copy link

TH-Soft commented Oct 1, 2023

Textframes do not break to the next page, this is by design.
Callers must ensure that a textframe fits onto the page.

@kobruleht
Copy link
Author

MigraDoc should add page break before such textframe.
This issue occurs since paragraph inside textframe stretches to two lines but textframe height is only single line.

@ThomasHoevel
Copy link
Member

MigraDoc should add page break before such textframe.

The software architect of MigraDoc decides what MigraDoc should do. I'll ask him about it.

@kobruleht
Copy link
Author

kobruleht commented Oct 2, 2023

PDFs are created from report template which contains text fields having left, height, width and top properties:

image

Paragraph does not have position and size. So text is added to paragraph inside TextFrame. Paragraph contains variable number of lines and has variable height. Page break should inserted if top position + height is greater that printable area in page.

If textFrame is not used, it is not possible to specify paragraph width.

There are no method to get stretched paragraph height. If paragraph height is known, TextFrame height can set to this value and non-floating TextFrames are probably paged correctly.

@kobruleht kobruleht changed the title Text wrapped to multiple lines is truncated in end of page Overflowing paragraph text in TextFrame is not fully visible in end of page Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants