johnfercher / maroto

A maroto way to create PDFs. Maroto is inspired in Bootstrap and uses gofpdf. Fast and simple.
https://maroto.io
MIT License
1.46k stars 172 forks source link

Low quality QR codes #413

Closed ianzren closed 1 week ago

ianzren commented 1 month ago

Describe the bug Not sure if this is a bug or intended but noticed that the generated QR code is of much lower quality than the example in the docs. I ran the "simplest" example given locally which produced this pdf.

image

Docs

image

The generated PDF looks high quality in Chrome and Firefox but low quality in Safari. Physically printing the PDF also always returns a low quality qr code.

Simplest example code

func main() {
    m := GetMaroto()
    document, err := m.Generate()
    if err != nil {
        log.Fatal(err)
    }

    err = document.Save("./cmd/ian/ian.pdf")
    if err != nil {
        log.Fatal(err)
    }
}

func GetMaroto() core.Maroto {
    m := maroto.New()

    m.AddRow(20,
        code.NewBarCol(4, "barcode"),
        code.NewMatrixCol(4, "matrixcode"),
        code.NewQrCol(4, "qrcode"),
    )

    m.AddRow(10, col.New(12))

    m.AddRow(20,
        image.NewFromFileCol(4, "docs/assets/images/biplane.jpg"),
        signature.NewCol(4, "signature"),
        text.NewCol(4, "text"),
    )

    m.AddRow(10, col.New(12))

    m.AddRow(20, line.NewCol(12))

    return m
}
johnfercher commented 1 month ago

I don't know what this can be. But I know that there are printed codes that are in good quality, since maroto is used in production envs world wide.

Fernando-hub527 commented 2 weeks ago

I don't know if this is relevant information, but testing in the Debiam document viewer, I had the same result as you, but when zooming in on the image the quality seems to have remained as in the example in the documentation, this low quality is not related to some configuration in the pdf reader? Unfortunately I don't have access to a printer or safari to validate this possibility.

johnfercher commented 1 week ago

Since there is no response after 2 weeks, and we know that the QRCodes and Barcodes are working in other platforms I will close this.