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

Text overlapping Page Numbers
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3036
Page 1 of 1

Author:  xFlowDev [ Mon Jan 26, 2015 10:49 am ]
Post subject:  Text overlapping Page Numbers

Hello,
I'm creating an invoice with Migradoc and until this point I haven't had any greater problems I couldn't deal with. But now I'm trying to create something like a footer but still above the page numbers.
I want the text to always be at the bottom of the page but ,like I said still above the page numbers.
Is there a way to accomplish that ?

This is what I've got so far:
Code:
            #region ArtikelTabelle

            Paragraph lParagraph = lSection.AddParagraph();
            lParagraph.Format.FirstLineIndent = Unit.FromCentimeter(2.2);
            lParagraph.Format.SpaceBefore = Unit.FromCentimeter(2);
            lParagraph.AddText("Lieferschein");
            lParagraph.Format.Font.Size = 16;
            lParagraph.Format.Font.Bold = true;
            lParagraph.Format.SpaceAfter = 10;
            Table lTable = lSection.AddTable();

            lTable.Borders.Width = 0.75;
            lTable.Borders.Color = Color.Parse(ccGitterlinien); ;
            lTable.BottomPadding = 5;
            lTable.TopPadding = 5;
            lTable.Format.PageBreakBefore = true;

            Column lColumn = lTable.AddColumn(Unit.FromCentimeter(1));
            lColumn.Format.Alignment = ParagraphAlignment.Center;

            lTable.AddColumn(Unit.FromCentimeter(3));
            lColumn.Format.Alignment = ParagraphAlignment.Left;

            lTable.AddColumn(Unit.FromCentimeter(5));
            lColumn.Format.Alignment = ParagraphAlignment.Center;

            lTable.AddColumn(Unit.FromCentimeter(9));

            Row lRow = lTable.AddRow();
            lRow.VerticalAlignment = VerticalAlignment.Center;

            Cell lCell = lRow.Cells[0];
            lRow.Shading.Color = Colors.LightGray;
            lRow.HeadingFormat = true;
            lCell.AddParagraph("Pos.");
            lCell = lRow.Cells[1];
            lCell.AddParagraph("Menge");
            lCell = lRow.Cells[2];
            lCell.AddParagraph("ArtikelNr");
            lCell = lRow.Cells[3];
            lCell.AddParagraph("Beschreibung");

            var tabelle = new List<Artikel>();

            var lArtikel1 = new Artikel();

            lArtikel1.ArtikelNr = "123456";
            lArtikel1.Menge = 4;
            lArtikel1.MengenEinheit = "Stk.";
            lArtikel1.Beschreibung = "Hallo";

            var lArtikel2 = new Artikel();

            lArtikel2.ArtikelNr = "123456";
            lArtikel2.Menge = 4;
            lArtikel2.MengenEinheit = "Stk.";
            lArtikel2.Beschreibung = "Hallo";

            tabelle.Add(lArtikel1);
            tabelle.Add(lArtikel2);
            tabelle.Add(lArtikel2);
            tabelle.Add(lArtikel2);
            tabelle.Add(lArtikel2);
            tabelle.Add(lArtikel2);
            tabelle.Add(lArtikel2);
            tabelle.Add(lArtikel2);
            tabelle.Add(lArtikel2);
            tabelle.Add(lArtikel2);
            tabelle.Add(lArtikel2);
            tabelle.Add(lArtikel2);

            var lPosition = 1;
            foreach (var lArtikel in tabelle)
            {
               


                lRow = lTable.AddRow();
                lCell = lRow.Cells[0];
                lCell.AddParagraph(lPosition.ToString());
                lCell = lRow.Cells[1];
                lCell.AddParagraph(lArtikel.Menge + " " + lArtikel.MengenEinheit);
                lCell = lRow.Cells[2];
                lCell.AddParagraph(lArtikel.ArtikelNr);
                lCell = lRow.Cells[3];
                lCell.AddParagraph(lArtikel.Beschreibung);

                lPosition++;

            }




            #endregion

            TextFrame lFooterFrame = lSection.AddTextFrame();
            Paragraph lFooterParagraph =  lFooterFrame.AddParagraph();
            lFooterParagraph.Format.PageBreakBefore = true;
           
            lFooterFrame.Width = Unit.FromCentimeter(18);
            lFooterFrame.RelativeHorizontal = RelativeHorizontal.Character;
            lFooterFrame.RelativeVertical = RelativeVertical.Margin;
            lFooterParagraph.Format.Alignment = ParagraphAlignment.Left;
            lFooterFrame.Top = Unit.FromCentimeter(3);
            lFooterParagraph.AddText("Bemerkungen");
            lFooterParagraph.AddLineBreak();
            lFooterParagraph.AddText("Lorem ipsum dolor sit amet, " +
                                     "consetetur sadipscing elitr, sed diam " +
                                     "nonumy eirmod tempor invidunt ut labore et dolore " +
                                     "magna aliquyam erat, sed diam voluptua. At vero eos et accusam " +
                                     "et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata " +
                                     "sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur " +
                                     "sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna " +
                                     "aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et " +
                                     "ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor " +
                                     "sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy " +
                                     "eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. " +
                                     "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, " +
                                     "no sea takimata sanctus est Lorem ipsum dolor sit amet.");




            #region Seitenzahl

            lSection.PageSetup.OddAndEvenPagesHeaderFooter = true;
            lSection.PageSetup.StartingNumber = 1;

            HeaderFooter lHeader = lSection.Headers.Primary;
            lHeader.AddParagraph();

            lHeader = lSection.Headers.EvenPage;
            lHeader.AddParagraph();

            Paragraph lPageParagraph = new Paragraph();
            lPageParagraph.AddText("-");
            lPageParagraph.AddPageField();
            lPageParagraph.AddText("-");
            lPageParagraph.Format.Alignment = ParagraphAlignment.Center;


            lSection.Footers.Primary.Add(lPageParagraph);
            lSection.Footers.EvenPage.Add(lPageParagraph.Clone());

            #endregion
           





            PdfDocumentRenderer lRenderer = new PdfDocumentRenderer(true, PdfFontEmbedding.Always);
            lRenderer.Document = xDocument;
            lRenderer.RenderDocument();


And like you see in the attached images the table works perfectly and so do the page numbers, but the text won't.
Attachment:
File comment: The text i want to write
text.PNG
text.PNG [ 46.03 KiB | Viewed 4397 times ]

Attachment:
File comment: the whole document
gesamt.png
gesamt.png [ 48.83 KiB | Viewed 4397 times ]


Thanks, in Advance :)

Author:  Thomas Hoevel [ Mon Jan 26, 2015 11:02 am ]
Post subject:  Re: Text overlapping Page Numbers

Hi!

Just don't put your "Bemerkungen" into a TextFrame. You can use KeepTogether and KeepWithNext to avoid PageBreaks within this text (if that's what you want).
The "Bemerkungen" will appear only once below the table.

Or increase BottomMargin and FooterDistance in the PageSetup of your section to make room for the longer footer and add the "Bemerkungen" to the footer.
With version 1.50 beta you can have several paragraphs in the footer without TextFrames. In that case the "Bemerkungen" (remarks) will appear on every page.

Author:  xFlowDev [ Mon Jan 26, 2015 12:17 pm ]
Post subject:  Re: Text overlapping Page Numbers

I wanted to keep them together and only once on the whole document and that's working now.
Thanks again. :D

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