QuestPDF / QuestPDF

QuestPDF is a modern open-source .NET library for PDF document generation. Offering comprehensive layout engine powered by concise and discoverable C# Fluent API. Easily generate PDF reports, invoices, exports, etc.
https://www.questpdf.com
Other
12k stars 629 forks source link

Transparent SVG set as Background does not show on PDF file but shows in previewer #791

Open jaguarxii opened 8 months ago

jaguarxii commented 8 months ago

Describe the bug Background does not show on PDF file but shows in previewer

To Reproduce Create a SVG that has transparency to set as watermark, in my example it has 10% opacity.

`

public void Compose(IDocumentContainer container) { TextStyle dafaultStyle = TextStyle.Default.FontFamily("Nunito"); SKSvg svgWatermark = new SKSvg(); svgWatermark.FromSvg(pdfAux.pdfConstants["pdf_watermark"]);

    container
        .Page(page =>
        {
            page.DefaultTextStyle(dafaultStyle);
            page.Size(PageSizes.A4.Portrait());
            page.Margin(0, Unit.Millimetre);

            page.Header().Element(ComposeHeader);

            page.Background().AlignCenter().AlignMiddle().Width(250).Height(250).Svg(svgWatermark);

`

Expected behavior The background should appear on the PDF file as it appears in the previewer

Screenshots image

Environment Windows 11 / dotnet 8 / webapp MVC Debian 12 / dotnet 8 / webapp MVC QuestPDF 2023.12.6 HarfBuzzSharp.NativeAssets.Linux 7.3.0.1 SkiaSharp, SkiaSharp.HarfBuzz, SkiaSharp.NativeAssets.Linux 2.88.7 Svg.Skia 1.0.0.13

MarcinZiabek commented 8 months ago

Thank you for reporting this issue. Would you please share the SVG file? 😄

jaguarxii commented 8 months ago

Hi, here it is transparent-svg