Skip to content

doc.internal.pageSize.getWidth() doesn't match measured value #2927

@Tobbe

Description

@Tobbe
function pdf() {
  const { jsPDF } = window.jspdf;
  const doc = new jsPDF("p", "px", "a4");
  const pageWidth = doc.internal.pageSize.getWidth();
  console.log("pageWidth", pageWidth);
  
  doc.save("pagesize.pdf")
}

You can run the above code here: https://jsfiddle.net/6htnzja8/1/

Running the example code and looking in the console jsPDF says the page width is 446.46 pixels. If I take a screenshot of the generated PDF and measure the size it's actually 793 pixels wide.

I think the value reported by jsPDF is wrong. Is it, or am I misunderstanding something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions