Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ℹ️ File size increases with endroid/qr-code 5.0.8 #249

Closed
sdespont opened this issue May 2, 2024 · 6 comments · Fixed by #252
Closed

ℹ️ File size increases with endroid/qr-code 5.0.8 #249

sdespont opened this issue May 2, 2024 · 6 comments · Fixed by #252
Labels
third-party-bug A bug from a different provider is blocking

Comments

@sdespont
Copy link
Contributor

sdespont commented May 2, 2024

After updating endroid/qr-code from version 5.0.4 to the latest version (5.0.8), the size of a PDF generated by TCPDFOutput increases by around 15% for a single page, and by around 50% for a 120-page document!

Work has been done on block spacing in this commit:
endroid/qr-code@0cc00f0

Have you noticed the same behaviour with HTML or other rendering?

@sprain
Copy link
Owner

sprain commented May 2, 2024

@sdespont are you talking about file size or pixel size of the qr code?

@sdespont
Copy link
Contributor Author

sdespont commented May 2, 2024

@sprain sorry, I am talking about the file size

@sprain
Copy link
Owner

sprain commented May 2, 2024

Thanks!
Then it‘s a bit annoying, but not really urgent for most users (I know it is likely for you).

@sprain sprain changed the title Warning : final render size increase because of endroid/qr-code 5.0.8 Warning : file size increases because of endroid/qr-code 5.0.8 May 2, 2024
@sdespont
Copy link
Contributor Author

sdespont commented May 2, 2024

@sprain I'm going to contact endroid/qr-code but I thought it was important to inform users of the library too.

Can you let this issue open until a fix is released ?

@sprain sprain changed the title Warning : file size increases because of endroid/qr-code 5.0.8 ℹ️ File size increases with endroid/qr-code 5.0.8 May 3, 2024
@sprain sprain added the third-party-bug A bug from a different provider is blocking label May 3, 2024
@sdespont
Copy link
Contributor Author

@sprain endroid/qr-code releases 5.0.9 version to keep compatibility with previous SVG image creation method using <defs> element instead of <path>. There is a new option to chose between theses formats : SvgWriter::WRITER_OPTION_COMPACT

Would you OK for a PR adding a public function setOptions(array $options) to the QrCode class ?

private array options = [SvgWriter::WRITER_OPTION_FORCE_XLINK_HREF => true];

public function setOptions(array $options): void
{
    $this->options = $options;
}

And the write method whould use the options like like

    private function getQrCodeResult(): ResultInterface
    {
        return $this->qrCodeWriter->write(
            $this->qrCode,
            $this->qrCodeLogo,
            null,
            $this->options
        );
    }

In my view, the options should be fixed within the output class itself; there's no necessity to pass the options in the constructor of TcPdfOutput, for instance.

@sprain
Copy link
Owner

sprain commented May 14, 2024

@sdespont The general idea looks good, go for it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
third-party-bug A bug from a different provider is blocking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants