Hi,
I have a function to render my pages, I call this function each time I have finished creating a "Page" a page may potentially overflow onto a 2nd or 3rd etc. page if the content is too long.
Currently I am using:
Code:
public void RenderPgs()
{
try
{
Renderer = new DocumentRenderer(CommonData.Instance.Document);
Renderer.PrepareDocument();
try
{
Renderer.RenderPage(Gfx, CommonData.Instance.PdfDocument.PageCount);
Gfx.Dispose();
}
catch
{
}
int _pgCnt = CommonData.Instance.PdfDocument.PageCount;
if (CommonData.Instance.PdfDocument.PageCount < Renderer.FormattedDocument.PageCount)
{
while (CommonData.Instance.PdfDocument.PageCount < Renderer.FormattedDocument.PageCount)
{
try
{
string _title = Page.Tag.ToString();
if (Page.Orientation == PageOrientation.Landscape)
{
AddPage(PageOrientation.Landscape);
}
else
{
AddPage();
}
SetupHeaderFooter(_title + "overflow");
//break;
}
catch
{
}
}
if (_pgCnt < CommonData.Instance.PdfDocument.PageCount)
{
for (int i = _pgCnt; i < CommonData.Instance.PdfDocument.PageCount; i++)
{
Renderer = new DocumentRenderer(CommonData.Instance.Document);
Renderer.PrepareDocument();
Renderer.RenderPage(Gfx, i + 1);
Gfx.Dispose();
}
}
}
}
catch
{
}
}
As you may notice I am essentially rendering a page at the top, but lower down in the if condition, I check if the MigraDoc Document contains more pages than the PdfDocument, and then loop to recursivly add pages, I then loop through the added pages (once they have all been added) and render them each in turn. I am having a problem, becuase I need the page header on the "additional" pages to be correct, rather than the page number of the previous page. the function SetupHeaderFooter() should technically do this, but even when I set the parameter to something like "testing123" so it will replace the test in the page header on the "additional" page it is still using the text from the header on the previous "normal" page? I thought calling Renderer.PrepareDocument() may kind of refresh it, so it would pick up the new header, but it doesnt seem to!
Any ideas?
I am using v1.2
Also, I have build up a large number of functions which work with v1.2, will upgrading to v1.3 cause these to break? i.e. is v1.3 totally backwards compatible?
thanks
Mike