public void Render(Form form, PdfPage pdfPage, PdfRendererOptions options = null) { options = options ?? PdfRendererOptions.Default; using (var localBitmapCache = new PdfBitmapCache()) { using (var g = CreateGraphics(pdfPage, options)) { var size = DetermineMaxSize(pdfPage, options, g); form.LayOut(size, CreateContext(g, localBitmapCache)); if (options.AdjustPageSize) { AdjustPageSize(form, pdfPage, g); } } using (var g = CreateGraphics(pdfPage, options)) Render(CreateContext(g, localBitmapCache), form.Content); } }
private PdfRendererContext CreateContext(XGraphics g, PdfBitmapCache localBitmapCache) => new PdfRendererContext(g, FontResolver, localBitmapCache);
public PdfRendererContext(XGraphics graphics, PdfFontResolver fontResolver, PdfBitmapCache localBitmapCache) { _localBitmapCache = localBitmapCache; Graphics = graphics; FontResolver = fontResolver; }