Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Feat/create document with weasyprint options #163

Merged
merged 2 commits into from
May 23, 2023

Conversation

jbpenrath
Copy link
Member

@jbpenrath jbpenrath commented May 22, 2023

Purpose

Weasyprint 59.0 introduces new options to pass to the write_pdf method. It could be interesting to allow marion consumers to be able to use them.

Since Weasyprint 59.0, the pdfminer extract_text method raises a TypeError when PDF compression is enable, so until the issue is fixed, we decide to disable it but allow consumers to enable it at their own risk.

Kozea/WeasyPrint#1885
pdfminer/pdfminer.six#886

Proposal

  • Pin Weasyprint to version greater than equal to 59.0
  • Add pdf_options parameter to AbstractDocument.create method
  • Write tests

@jbpenrath jbpenrath self-assigned this May 22, 2023
@jbpenrath jbpenrath force-pushed the feat/create-document-with-weasyprint-options branch from d0ac5de to a9bc452 Compare May 22, 2023 14:28
Weasyprint 59.0 add new options to the `Document.write_pdf` method. As we want
to use it, we have to pin it to a version greater than equal 59.0
@jbpenrath jbpenrath force-pushed the feat/create-document-with-weasyprint-options branch from a9bc452 to f96f8f9 Compare May 22, 2023 14:40
Copy link
Contributor

@quitterie-lcs quitterie-lcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

CHANGELOG.md Outdated Show resolved Hide resolved
@jbpenrath jbpenrath force-pushed the feat/create-document-with-weasyprint-options branch 2 times, most recently from 719fddb to 6f462a3 Compare May 23, 2023 13:27
We want Marion consumers be able to use new pdf options offered by weasyprint 59
.0. In order to do that, we add a new `pdf_options` argument to the
`AbstractDocument.create` method.
Furthermore, weasyprint 59.0 with pdf compression enable is no more compatible
with pdfminer extract text. So until this issue is fixed, we disable by default
the pdf compression. But consumers are able to enable this option at their own
risks through the `pdf_options` argument.
@jbpenrath jbpenrath force-pushed the feat/create-document-with-weasyprint-options branch from 6f462a3 to f71b888 Compare May 23, 2023 13:30
@jbpenrath jbpenrath merged commit e1a5331 into master May 23, 2023
@jbpenrath jbpenrath deleted the feat/create-document-with-weasyprint-options branch May 23, 2023 13:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants