예제 #1
0
        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);
            }
        }
예제 #2
0
 private PdfRendererContext CreateContext(XGraphics g, PdfBitmapCache localBitmapCache) => new PdfRendererContext(g, FontResolver, localBitmapCache);
예제 #3
0
 public PdfRendererContext(XGraphics graphics, PdfFontResolver fontResolver, PdfBitmapCache localBitmapCache)
 {
     _localBitmapCache = localBitmapCache;
     Graphics          = graphics;
     FontResolver      = fontResolver;
 }