Skip to content

image (or canvas) size #6

@Palvalo

Description

@Palvalo

Hi @eKoopmans
first of all, thank you for an amazing tool for creating PDFs, I appreciate the quality settings and simplicity of its usage!

The issue I am solving right now is how can I set the canvas (or an image of it) to the same size as the page of pdf has.

I am trying something like this:
html2canvas: { dpi: 192, letterRendering: true, width: docWidth, height: docHeight }
jsPDF: { unit: "mm", format: [docHeight, docWidth], orientation: "p" }
or this:
image: { type: 'jpeg', quality: 1, width: docWidth, height: docHeight }

The second one is invalid, image width or height cannot be changed here, the first one gives strange results - the screenshot appears to be scaled but its position is shifted.

My overall goal is to get a screenshot of the html element - which I am getting. But this screenshot should be of the same size as pdf document is and fit to the page perfectly (that means it is placed at coordinates (0,0) of the document page).

How can I achieve this?
Thanks for your response.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions