-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add pic support #543
Add pic support #543
Conversation
Bumps [qrcode](https://github.com/kennytm/qrcode-rust) from 0.14.0 to 0.14.1. - [Release notes](https://github.com/kennytm/qrcode-rust/releases) - [Commits](https://github.com/kennytm/qrcode-rust/commits/v0.14.1) --- updated-dependencies: - dependency-name: qrcode dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, please do the following:
$ reuse annotate -c "<YOUR_NAME>" -y "<YEAR>" <CHANGED_FILES>
Merged as 01009da. Thanks! |
Thanks for reviewing, approving and merging the suggested changes in this PR, @sorairolake, very much appreciated! 😄 I look forward to the next release of qrtool and will keep a keen eye on the releases 👀 |
@afh I generated a PDF file from PIC with the following (2bb143a): qrtool encode -t pic "QR code" | groff -Tpdf -p -P-p3i,3i > output.pdf The result of converting this PDF file to a PNG image is as follows: magick output.pdf output.png This seems like an incorrect result to me. How can I produce the correct result? Environment$ groff --version
GNU groff version 1.23.0
Copyright (C) 2022 Free Software Foundation, Inc.
GNU groff comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of groff and its subprograms
under the terms of the GNU General Public License.
For more information about these matters, see the file
named COPYING.
called subprograms:
GNU grops (groff) version 1.23.0
GNU troff (groff) version 1.23.0
$ lsb_release -sd
"Arch Linux" |
Thanks for reaching out, @sorairolake. TL;DR: qrtool encode -t pic "QR code" \
| awk 'BEGIN{print ".vs 0\n.po 0\n.PS"} END{print "scale=25.4*3\n.PE"} {print}' \
| groff -Tpdf -p -P-p3i,3i \
> output.pdf To make the QR code fill the PDF page (as I think you intend to) the TL;DR example does the following:
Given the nature of PIC (or my understanding of it) it isn't as much of a stand-alone graphics format, but rather something that is pre-processed and then embedded in groff or TeX documents. What From my experience it is easier/more convenient to have a document that uses
where .PS
# other document specific PIC code to "customize/annotate" the QR code
copy "qrcode.pic"
.PE is easier/more flexible than:
where .so qrcode.pic What would be ideal, I guess, is a stand-alone mode, in which qrtool (or qrcode-rust) adds the surrounding Hopefully I've been able to explain well what the idea of how to use this is. Happy to hear feedback on where this maybe falls shorts or could be improved 🙂 What do you think, @sorairolake? 1 ℹ️ I am the author of the PRs (kennytm/qrcode-rust#65, kennytm/qrcode-rust#66) that add support for PIC to qrcode-rust and any short-comings in these are my |
@afh I think it would be useful if the documentation of the Based on your comments, I'll add to the README how to do something similar to the following: qrencode -t PIC "qrencode PIC test" | groff -Tpdf -p -P-p3i,3i > qrcode.pdf |
Sounds good, @sorairolake, do let me know if I can help with anything related 🙂 |
I didn't look closely at I think the output of the |
Description
Add support for PIC output format, which was added to
qrcode-rust
0.14.1
(released July 5th) withkennytm/qrcode-rust#65
.Unfortunately my Rust expertise is rather lacking, hence the crude implementation. I'd greatly appreciated advice and guidance on how to improve this PR. I'm dissatisfied with the
if-else
in order to handle the givenmodule_size
and dislike that thereforemargin
is ignored.Trying to follow the same approach as
to_svg
and callmodule_dimensions
on a previously created renderer:result in the following error for me:
Hopefully I've been able to explain well, what I'd like to achieve and which errors I run into, if not please ask me to clarify 🙂
ℹ️ This PR includes the changes from #539 (pending review and approval) to update
qrcode-rust
to0.14.1
Additional context
— Wikipedia
It is most commonly used in typesetting documents using implementations of roff, such as GNU roff, Plan 9 troff, or heirloom doctools to name a few.
Checklist