Skip to content

Question of Canvas to PDF size (关于Canvas生成PDF文档尺寸的疑问) #2548

@Simon7520

Description

@Simon7520

Question:
I use createCanvas(width, height, 'pdf') to create a canvas for painting, then I use toBuffer('application/pdf') to generate a pdf document.The size unit of canvas should be px, while the size unit of PDF document is cm. I don't understand how the width and height here are related to the width and height of PDF document? Is it converted using the default 72dpi,at least the result I ran locally looks like this?

我使用createCanvas(width,height,'pdf')创建画布进行绘画,然后使用toBuffer('application/pdf')生成pdf文档。画布的大小单位应该是px,而PDF文档的大小单位是cm。我不明白这里的宽度和高度与PDF文档的宽度和长度有什么关系?难道是使用默认的72dpi来进行转换的吗?至少我本地运行的结果看起来是这样。

Can someone answer the question for me?

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