Skip to content

Flickering Issue When Printing to PDF (Render Overlapping) #4842

@manaruto

Description

@manaruto

I am experiencing a flickering issue when exporting a ScottPlot figure to a PDF using SKDocument.CreatePdf(). The issue occurs only in the PDF file (not in the interactive plot itself).

When zooming into PDF, it appears as though multiple overlapping images are rendered momentarily in the PDF before stabilizing.

Observed Behavior:

The interactive plot works fine.
The PDF file flickers when opened, as if multiple layers are rendered over each other before settling.
The issue is noticeable during zooming the pdf file

ScottPlot 5.0.54

            using FileStream stream = File.OpenWrite("Plot.pdf");
           
            //2) Create PDF Document with Fixed DPI
            using SKDocument pdfDocument = SKDocument.CreatePdf(stream, new SKDocumentPdfMetadata
            {
                Title = "ScottPlot PDF",
                Author = "Your Name",
                RasterDpi = 300 // Ensures high print resolution
            });


            float pageWidth = 8.5f * 72; // 8.5 inches @ 72 DPI = 612 points
            float pageHeight = 11f * 72;   // 11 inches @ 72 DPI = 792 points

            //  4) Begin a Page in the PDF Document
            using (var pdfCanvas = pdfDocument.BeginPage(pageWidth, pageHeight))
            {
                plt.Render(pdfCanvas, (int)pageWidth, (int)pageHeight);
                pdfDocument.EndPage();
            }

            pdfDocument.Close();

I tried simple two polygon above each other, also i tried stacked area chart.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions