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

Kerning issues after merging pages #1517

Closed
pferreir opened this issue Dec 8, 2021 · 5 comments
Closed

Kerning issues after merging pages #1517

pferreir opened this issue Dec 8, 2021 · 5 comments

Comments

@pferreir
Copy link

pferreir commented Dec 8, 2021

Hello. First of all, congratulations for this library. I'm impressed at how accurate the DOM layout implementation is!

I am using weasyprint in a web app and trying to produce a multi-page PDF. The only way I found to do that (short of using some separate lib to manually join weasyprint-produced PDFs) was a code fragment I found in your docs:

all_pages = [p for doc in documents for p in doc.pages]
documents[0].copy(all_pages).write_pdf('combined.pdf')

This works fine, except that then I get very serious kerning/space issues in the resulting PDF. Some letters end up really too far apart and break words apart.

Is this a known issue and what can I do to avoid it?

Thanks!

@liZe
Copy link
Member

liZe commented Dec 8, 2021

Hello!

First of all, congratulations for this library. I'm impressed at how accurate the DOM layout implementation is!

💛

This works fine, except that then I get very serious kerning/space issues in the resulting PDF.

This problem really looks like #1489. Do you use the latest 53.4 version?

@pferreir
Copy link
Author

pferreir commented Dec 9, 2021

You are absolutely right! Apologies, I should have upgraded to the latest version. I'll close the ticket.

@pferreir pferreir closed this as completed Dec 9, 2021
@SchrodingersGat
Copy link

SchrodingersGat commented Aug 15, 2022

@liZe I have found a regression here - documented below. Please LMK if you want me to start a new issue rather than resurrecting this thread.

This issue has returned in v56.1 - I have confirmed by switching between 56.1 and 53.4 (without any other changes).

53.4 56.1
image image

And the code used to merge these PDF files together:

pages = []

for output in outputs:
    doc = output.get_document()
    for page in doc.pages:
        pages.append(page)

pdf = outputs[0].get_document().copy(pages).write_pdf()

Some further testing reveals that:

  • 55.0 : BAD
  • 54.3: GOOD

@liZe
Copy link
Member

liZe commented Aug 15, 2022

That’s maybe related to #1662.

@liZe
Copy link
Member

liZe commented Aug 15, 2022

That’s maybe related to #1662.

Yes, that’s definitely a duplicate of #1662. Mixing pages from different documents (as in your issue) or adding elements into the tree after the rendering (as in #1662) are features that are not explicitly prevented by WeasyPrint, but they were not supposed to work and to be supported 😀.

Let’s continue the discussion in #1662.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants