Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js PDFTron NodeJS FreeText注释setFontSize=0不会自动缩放文本_Node.js_Pdftron - Fatal编程技术网

Node.js PDFTron NodeJS FreeText注释setFontSize=0不会自动缩放文本

Node.js PDFTron NodeJS FreeText注释setFontSize=0不会自动缩放文本,node.js,pdftron,Node.js,Pdftron,我使用的是PDFTron NodeJS软件包版本8,我似乎无法使用FreeTextAnnot setFontSize(0)来自动缩放文档中描述的文本 await PDFNet.startDeallocateStack() const doc = await PDFNet.PDFDoc.createFromFilePath(filePath("some.pdf")) const txtannot = await PDFNet.FreeTextAnnot.create( d

我使用的是PDFTron NodeJS软件包版本8,我似乎无法使用FreeTextAnnot setFontSize(0)来自动缩放文档中描述的文本

await PDFNet.startDeallocateStack()
const doc = await PDFNet.PDFDoc.createFromFilePath(filePath("some.pdf"))

const txtannot = await PDFNet.FreeTextAnnot.create(
  doc,
  new PDFNet.Rect(100, 100, 300, 300),
)

await txtannot.setContents('TEXT')
await txtannot.setFontSize(0)
const page = await doc.getPage(1)
await page.annotPushBack(txtannot)
await txtannot.refreshAppearance()

await doc.save(
    filePath("exported.pdf"),
    PDFNet.SDFDoc.SaveOptions.e_linearized,
)

await PDFNet.endDeallocateStack()
当我打开文件
exported.pdf
时,txtannot的内容文本没有调整以填充边界矩形。请注意,我在PDFTron的web版本中可以很好地实现这一点

有什么我错过的吗