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
11.67k stars 608 forks source link

Dotted Line #577

Open selvam920 opened 1 year ago

selvam920 commented 1 year ago

How to create dotted lines? How to create QR Code?

girlpunk commented 1 year ago

QR codes are not a native PDF element, however you could create one with an image or a Skia library such as SkiaSharp.QrCode

selvam920 commented 1 year ago

What about dotted line?

MarcinZiabek commented 1 year ago

What about dotted line?

This implementation allows to draw dotted lines by directly using the SkiaSharp library 😁

.Canvas((canvas, space) =>
{
    // best to statically cache
    using var paint = new SKPaint
    {
        StrokeWidth = space.Height,
        PathEffect = SKPathEffect.CreateDash(new float[] { 1, 3 }, 0)
    };

    canvas.DrawLine(0, 0, space.Width, 0, paint);
});

Example usage: https://github.com/QuestPDF/QuestPDF/blob/6518ecf52e5da626ad7554fdabf3c29dcbeba0c0/Source/QuestPDF.ReportSample/Layouts/TableOfContentsTemplate.cs#LL51C1-L61C24