Skip to content

Allow / Enable presentation hintsΒ #38

@jm-lamotte

Description

@jm-lamotte

Hello,
Thanks for the code, it allowed me to very quickly render PDF in Django.
One thing I could not do with your latest release is to resize images in a PDF. I looked around, and found the presentation_hints parameter that can be passed in the "HTML" or "write_pdf". I updated the last lines of renders.py file from

html = select_template(template).render(context)
HTML(string=html, base_url="not-used://", url_fetcher=url_fetcher,).write_pdf(
    target=file_,
)

to

html = select_template(template).render(context)
HTML(string=html, base_url="not-used://", url_fetcher=url_fetcher,).write_pdf(
    target=file_, presentation_hints = True,
) 

And now I can use width / height to resize the images that are included in my template.

I'll leave it to you to update or add another setting somewhere to allow this.

Thanks again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions