]>
git.kianting.info Git - clo/blob - tests/pdfManipulation.ts
6daaa1445a4bd49f39e93ac771235f83885912ed
1 import * as canva from
"../src/canva.js";
2 import {createWriteStream
} from
'fs';
3 import PDFDocument from
'pdfkit';
6 family
: "Noto Sans CJK TC",
8 textWeight
: canva
.TextWeight
.REGULAR
,
9 textStyle
: canva
.TextStyle
.ITALIC
,
15 textWeight
: canva
.TextWeight
.BOLD
,
16 textStyle
: canva
.TextStyle
.ITALIC
,
20 family
: "noto sans arabic",
22 textWeight
: canva
.TextWeight
.REGULAR
,
23 textStyle
: canva
.TextStyle
.NORMAL
,
28 async function foo (){
30 const doc
= new PDFDocument();
34 mainText
: ["123 一隻貓跑過來"],
35 mainFontStyle
: hanziFont
,
39 clo
.PDFCanvas
.pipe(createWriteStream('/tmp/output.pdf'));
43 await canva
.putText(clo
, clo
.mainText
[0],hanziFont
, 0, 100, 200);
44 await canva
.putText(clo
, "ag téastáil" ,romanFont
, 0, 100, 300);
45 await canva
.putText(clo
, "اَلْعَرَبِيَّةُ" ,arabicFont
, 0, 100, 350);