============》》》 JS代码 《《《 ============
//实例化pdf
let pdf=new clsPdf();
//添加字体文件
pdf.pdfAddFontFile("font/simfang.ttf","宋体")
pdf.pdfAddFontFile("font/STHUPO.TTF","ST")
//添加图片
pdf.pdfAddImage(fnJsa_rootPath()+"/images/a.jpg",0,0,100,100)
//换行,高度200,确保文字能看得到
pdf.pdfLn(100)
//输出文本,英文
pdf.pdfWrite(16,"test::ASAAA")
//输出文本,默认不支持中文,乱码,需要制定字体
pdf.pdfWrite(16,"中文能否正常现实文字信息")
pdf.pdfText(110,10,"TEXT")
pdf.pdfSetFont("宋体",16)
let linkID= pdf.pdfWriteLink(25,"链接,点我进入第三页");
//新增一页
pdf.pdfAddPage()
//设置使用字体及大小
pdf.pdfSetFont("宋体",16)
pdf.pdfWrite(26,"中文能否正常现实文字信息")
pdf.pdfLn(10)
pdf.pdfSetTextColor("#FF00FF")
pdf.pdfSetMargin(50,10,50)
pdf.pdfWrite(26,"中文能否正常现实文字信息")
pdf.pdfSetFont("ST",16)
pdf.pdfWrite(56,"中文能否正常现实文字信息2")
//取得当前字体大小
fnResponse_write("fontsize:"+ pdf.pdfGetFontSize())
pdf.pdfSetMargin(0,0,0)
//换行
pdf.pdfLn(30)
let pagecount= pdf.pdfPageCount()
pdf.pdfWrite(26,"总页数:"+pagecount)
//新增一页
pdf.pdfAddPage()
pdf.pdfSetFont("ST",16)
pdf.pdfWrite(16,"中文能否正常现实文字信息2")
pdf.pdfSetLinkPageLocation(linkID,20,-1)
//换行
pdf.pdfLn(20)
let html=" 我是中国人, 我爱中国";
pdf.pdfWriteHtml(20,html)
pdf.pdfLn(20)
pdf.pdfAddFontFile("font/STKAITI.TTF","ST","U")
pdf.pdfAddFontFile("font/STLITI.TTF","ST","B")
pdf.pdfAddFontFile("font/STLITI.TTF","ST","BI")
pdf.pdfAddFontFile("font/STXINGKA.TTF","ST","I")
let html2="You can now easily print text mixing different styles:
bold, " +
"
italic,
underlined, or
all at once!
" +
"
You can also center text." +
"
Or align it to the right." +
"You can also insert links on text, such as " +
"
www.fpdf.org, or on an image: click on the logo.";
pdf.pdfWriteHtml(20,html2)
let file=fnJsa_rootPath()+"/aa.pdf"
pdf.pdfSave(file)