]>
git.kianting.info Git - clo/blob - tests/pdfManipulation.ts
1 import * as canva from
"../src/canva.js";
2 import { PDFDocument
} from
"pdf-lib";
3 var fontkit
= require('@pdf-lib/fontkit');
4 import {writeFileSync
} from
'fs';
9 textWeight
: canva
.TextWeight
.BOLD
,
10 textStyle
: canva
.TextStyle
.ITALIC
,
14 async function foo (){
16 let c
= await PDFDocument
.create();
20 mainFontStyle
: hanziFont
,
25 clo
.PDFCanvas
.registerFontkit(fontkit
);
26 const page
= clo
.PDFCanvas
.addPage();
28 await canva
.putText(clo
, clo
.mainText
[0],hanziFont
, 0, 100, 200);
30 const pdfBytes
= await clo
.PDFCanvas
.save();
32 writeFileSync('/tmp/test.pdf', pdfBytes
);