protected internal void SetNewPageSizeAndMargins()
{
pageSize = nextPageSize;
if (marginMirroring && (PageNumber & 1) == 0) {
marginRight = nextMarginLeft;
marginLeft = nextMarginRight;
}
else {
marginLeft = nextMarginLeft;
marginRight = nextMarginRight;
}
if (marginMirroringTopBottom && (PageNumber & 1) == 0) {
marginTop = nextMarginBottom;
marginBottom = nextMarginTop;
}
else {
marginTop = nextMarginTop;
marginBottom = nextMarginBottom;
}
if (UseSeparateCanvasesForTextAndGraphics) {
text = new PdfContentByte(writer);
text.Reset();
} else {
text = graphics;
}
text.BeginText();
if (!UseSeparateCanvasesForTextAndGraphics)
textEmptySize = text.Size;
// we move to the left/top position of the page
text.MoveText(Left, Top);
}