Bug 153328 - QR code improvement: Use ZXing::ToSVG() instead of our own ConvertToSVGFormat() function
Summary: QR code improvement: Use ZXing::ToSVG() instead of our own ConvertToSVGFormat...
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected)
Hardware: All All
: medium normal
Assignee: raghav.29.khanna
Whiteboard: target:24.2.0
Keywords: difficultyMedium, easyHack, skillCpp
Depends on:
Blocks: QR-code
  Show dependency treegraph
Reported: 2023-02-02 15:03 UTC by Hossein
Modified: 2023-07-05 13:34 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2023-02-02 15:03:22 UTC
QR code is a type of 2d barcode that is useful for encoding data, including the URL, contact information and many other data types. The output can be easily scanned via applications on mobile phones to capture a URL or import contact information.

In LibreOffice, it is possible to create different barcodes, either 1d or 2d, via extensions, or LibreOffice internal functionality.

For QR codes, it is possible to use the internal functionality via Insert > OLE Object > QR and Barcode:


QR and Barcode
This functionality is implemented using ZXing library:


If you take a look at the source code in cui/source/dialogs/QrCodeGenDialog.cxx , there is ConvertToSVGFormat() function which creates the SVG output. In the recent versions of ZXing library (We use v1.4 right now), there is a function that does that, ZXing::ToSVG. The task here is to replace the our function with the better one from ZXing.
Comment 1 Mike Kaganski 2023-02-02 19:58:40 UTC
(In reply to Hossein from comment #0)
> In the recent versions of ZXing library (We use v1.4 right now)

Do we *require* recent enough versions, even when using system library? Or is that just the version that is guaranteed only when bundling?
Comment 2 Mike Kaganski 2023-02-02 20:12:13 UTC
(In reply to Hossein from comment #0)
> The task here is to replace the our function with the better one from ZXing.

Note also, that our implementation [1] is based on exactly the same code that the implementation in ZXing [2] is.

[1] https://opengrok.libreoffice.org/xref/core/cui/source/dialogs/QrCodeGenDialog.cxx?r=15e5d86c&mo=2367&fi=76#75
[2] https://github.com/zxing-cpp/zxing-cpp/commit/a2c64fe7b136b56afe7f6456ce21ef48bd1f50be#diff-4d566dcc828bc687016b9a8a1f05ab7e288cea209b2936ae746919b8fa64f948R48
Comment 3 Buovjaga 2023-02-03 08:10:58 UTC
Discussing in the chat, Mike said that ZXing::ToSVG() can be used conditionally.

We should not require 1.4.0 yet because it was only released in July 2022. Distro packaging status: https://repology.org/project/zxing-cpp-nu-book/versions
Comment 4 Commit Notification 2023-07-05 13:33:16 UTC
TRaXIn committed a patch related to this issue.
It has been pushed to "master":


tdf#153328 ZXing::ToSVG() Conditional usage

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:

Affected users are encouraged to test the fix and report feedback.