Generating PDF shows border around background transitions #1286
Unanswered
JohnnyClutch
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have many pngs that I'm combining into a business logic driven diagram using an html canvas (via Konva.js). I get the canvas the way I need it then call:
const pdfDoc = await PDFDocument.create();
pdfDoc.addPage(page);
const pdfBytes = await pdfDoc.save();
const file: Blob = new Blob([ pdfBytes ], { type: 'application/pdf' });
const fileURL = URL.createObjectURL(file);
window.open(fileURL);
As stated above, the images I use are "blocks" that I combine to create a single diagram, so I lay them over each other.
I tried removing the entire background color (white) of each image to transparent , but the process of doing so rendered the text in the images less than optimally readable, so I went through each image and removed the background only from areas where there wasn't any text. It looks really good in the web page.
As shown in the attachment, when I create the pdf, pdf-lib creates lines / border where the backgrounds still exists (the fainter inner border -- the darker one is intentional).
Beta Was this translation helpful? Give feedback.
All reactions