Hello,
I'm a new user of PDFSharp & MigraDoc (GDI v1.50.3915) and I have some questions to finalise my project.
Here a scheme of what I try to do:
1st page of my doc
other pages of my doc
The body of my document is a table which can be on many pages (it came from a database). On the last page, I added a paragraph.
code sample of my table:
Code:
Document migraDoc = new Document();
Section migraSection = migraDoc.AddSection();
migraSection.PageSetup.DifferentFirstPageHeaderFooter = true;
migraSection.PageSetup.TopMargin = Unit.FromMillimeter(HeightValue); // HeightValue = the height I need for my 1st header
// same stuff to all margin...
Table migraTable = migraDoc.LastSection.AddTable();
migraTable.AddColumn(Unit.FromMillimeter(ColumnWidth)); // I do as many column as I need
Row row = migraTable.AddRow(); // I do as many row as I need
Cell cell = row.Cells[index]; // I do as many cell in a row as column
Paragraph paragraph = cell.AddParagraph();
paragraph = HtmlString.ToMigradocParagraph(); // I convert a html string into a MigraDoc Paragraph
So the size of the 1st and primary header are different.
On MigraDoc, can we have a different Section.PageSetup.TopMargin to set y and y' and have the right amount of page during render?
What I need to print on the header and footer came from a SVG element like this:
Code:
<rect id="Cadre" x="5.1725mm" y="89.4099mm" width="198.624mm" height="7.1939mm" stroke-width="1" fill="none" stroke="black" rx="5" ry="5"></rect>
It's really easy to convert them into Xgraphics elements with PDFSharp.
A sample of what I do:
Code:
PdfDocument pdfDoc = new PdfDocument();
PdfPage pdfPage = pdfDoc.AddPage();
pdfPage.Size = PdfSharp.PageSize.A4;
XGraphics gfx = XGraphics.FromPdfPage(pdfPage, XGraphicsUnit.Millimeter);
DrawSvgElement(gfx, SvgElement); // I draw a Svg Element with XGraphics method.
At this point, I have a Document with my data table (with automatic page break) and a PdfDocument with my header and footer.
So I would like to use the pdfPage as a background of all Document's pages. How can I do this?
I tried stuff like this:
Code:
DocumentRenderer migraRenderer = new DocumentRenderer(migraDoc);
migraRenderer.PrepareDocument();
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer();
int nbPage = migraRenderer.FormattedDocument.PageCount; // the count is not great because I don't know how to adapt my table area
for (int i = 0; i < nbPage; i++)
{
migraRenderer.RenderPage(gfx, i + 1);
}
pdfRenderer.Document = migraDoc;
pdfRenderer.RenderDocument();
All that I have is a 1st page with the PdfSharp and my table on the others.
If I have a row bigger than my section, how can I split it into 2 rows?
Thanks