Create a PDF of my wallet #4

Closed
opened 12 months ago by laurin · 2 comments
Collaborator

Estimated time: 2 days

Estimated time: 2 days
laurin added this to the Alpha release 0.1.1 project 12 months ago
Owner

use this library for PDF generation, it works with WASM
https://github.com/pdf-rs/pdf

~~use this library for PDF generation, it works with WASM https://github.com/pdf-rs/pdf~~
Owner

as the QR-Code is SVG, we have to insert it as a FormXObject

you will have to use https://docs.rs/svg2pdf/latest/svg2pdf/
to convert the SVG into a FormXObject

with to_chunk

then add more chunks (the text that goes below the SVG) and give them to pdf_writer (which is included in svg2pdf)

https://docs.rs/pdf-writer/0.10.0/pdf_writer/struct.Chunk.html

example to add text:
https://github.com/typst/pdf-writer/blob/main/examples/hello.rs

https://github.com/typst/pdf-writer/blob/main/examples/chunks.rs

and then output the final PDF.

as the QR-Code is SVG, we have to insert it as a `FormXObject` you will have to use https://docs.rs/svg2pdf/latest/svg2pdf/ to convert the SVG into a FormXObject with `to_chunk` then add more chunks (the text that goes below the SVG) and give them to `pdf_writer` (which is included in svg2pdf) https://docs.rs/pdf-writer/0.10.0/pdf_writer/struct.Chunk.html example to add text: https://github.com/typst/pdf-writer/blob/main/examples/hello.rs https://github.com/typst/pdf-writer/blob/main/examples/chunks.rs and then output the final PDF.
niko self-assigned this 11 months ago
niko closed this issue 11 months ago
niko removed this from the Alpha release 0.1.1 project 10 months ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: NextGraph/nextgraph-rs#4
Loading…
There is no content yet.