DinkToPdf icon indicating copy to clipboard operation
DinkToPdf copied to clipboard

Barcode Label generation using Custom page size

Open Harshitsolanki opened this issue 4 years ago • 1 comments

Hi,

I need to print barcode labels using this to generate multiple barcodes Label size 4mmX 2mm. this label contains an QR Code and the product details .

Can you share how we can implement custom page size.

Regards Harshit

Harshitsolanki avatar Jun 08 '20 10:06 Harshitsolanki

Have you tried the custom paper size?

    globalSettings = new GlobalSettings
    {
        ColorMode = ColorMode.Color,
        Orientation = Orientation.Portrait,
        PaperSize = new PechkinPaperSize("XXmm", "XXmm"),
        Margins = new MarginSettings() { Top = MarginTop, Bottom = MarginBottom, Left = MarginLeft, Right = MarginRight },
        DocumentTitle = "Tag",
    };
    
    var pdf = new HtmlToPdfDocument()
    {
    GlobalSettings = globalSettings,
        Objects = { objectSettings }
    };
    
    file = await Task.Run(() => _pdfConverter.Convert(pdf));`

If you have already overcome this problem, what approach did you use?

silvairsoares avatar Nov 13 '23 18:11 silvairsoares