foliojs / pdfkit

A JavaScript PDF generation library for Node and the browser

Home Page:http://pdfkit.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

addPage会默认修改_ctm当前变换矩阵为非[1,0,0,1,0,0]

yinhui1129754 opened this issue · comments

Bug Report

在浏览器使用该插件的时候new PDFDocument 默认新增加的页面 _ctm应该是[1,0,0,1,0,0]才对 但是因为在设置了_ctm过后又调用了transform导致默认的初始化ctm变成[1,0,0,-1,0,page.height]

如果不修复这个bug在使用逆矩阵ctm的时候会导致一来就把页面反转了

Description of the problem

Code sample

修复bug应该交换两个代码的位置
在addPage方法中

this._ctm = [1, 0, 0, 1, 0, 0];
this.transform(1, 0, 0, -1, 0, this.page.height);

修改为这样就可以修复

this.transform(1, 0, 0, -1, 0, this.page.height);
this._ctm = [1, 0, 0, 1, 0, 0];

Your environment

  • pdfkit version:
  • Node version:
  • Browser version (if applicable):
  • Operating System:

English please