private FormattedText GetPageNumberText(PageNumberSettings pageNumberSettings, int pageNumber, int totalPages) { if (pageNumberSettings.PageOfAllPagesNotation) { return(GetPageNumberTextEnhanced(pageNumberSettings, pageNumber, totalPages)); } else { return(GetPageNumberTextNormal(pageNumberSettings, pageNumber)); } }
public void AddPageNumber(int pageNumber, int totalPages, PageNumberSettings pageNumberSettings) { var drawingVisual = new DrawingVisual(); using (DrawingContext ctx = drawingVisual.RenderOpen()) { FormattedText text = GetPageNumberText(pageNumberSettings, pageNumber, totalPages); ctx.DrawText(text, pageNumberSettings.Position); } this.Children.Add(drawingVisual); }
private FormattedText GetPageNumberTextNormal(PageNumberSettings pageNumberSettings, int pageNumber) { return(new FormattedText(pageNumberSettings.PagePrefix + " " + (pageNumber + 1), System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, pageNumberSettings.FontFamily, pageNumberSettings.FontSize, pageNumberSettings.FontBrush)); }
private FormattedText GetPageNumberTextEnhanced(PageNumberSettings pageNumberSettings, int pageNumber, int totalPages) { return(new FormattedText(pageNumberSettings.PagePrefix + " " + (pageNumber) + " von " + totalPages, System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, pageNumberSettings.FontFamily, pageNumberSettings.FontSize, pageNumberSettings.FontBrush)); }