基于Node.js的PDF工具包 PDFKit

码农软件 · 软件分类 · Node.js 扩展 · 2019-04-16 23:13:31

软件介绍

PDFKit 是一个用来在网页上查看和下载 PDF 文档的工具包。

示例代码:

   
PDFDocument = require 'pdfkit'
doc = new PDFDocument
# Embed a font, set the font size, and render some text
doc . font ( 'fonts/PalatinoBold.ttf' )
    . fontSize ( 25 )
    . text ( 'Some text with an embedded font!' , 100 , 100 )
# Add another page
doc . addPage ()
    . fontSize ( 25 )
    . text ( 'Here is some vector graphics...' , 100 , 100 )
# Draw a triangle
doc . save ()
    . moveTo ( 100 , 150 )
    . lineTo ( 100 , 250 )
    . lineTo ( 200 , 250 )
    . fill ( " # FF3300" )
# Apply some transforms and render an SVG path with the 'even-odd' fill rule
doc . scale ( 0.6 )
    . translate ( 470 , - 380 )
    . path ( 'M 250,75 L 323,301 131,161 369,161 177,301 z' )
    . fill ( 'red' , 'even-odd' )
    . restore ()
# Add some text with annotations
doc . addPage ()
    . fillColor ( "blue" )
    . text ( 'Here is a link!' , 100 , 100 )
    . underline ( 100 , 100 , 160 , 27 , color: " # 0000FF" )
    . link ( 100 , 100 , 160 , 27 , 'http://google.com/' )
# Write the PDF file to disk
doc . write 'output.pdf'

本文地址:https://codercto.com/soft/d/3745.html

程序员的自我修养

程序员的自我修养

俞甲子、石凡、潘爱民 / 电子工业出版社 / 2009-4 / 65.00

这本书主要介绍系统软件的运行机制和原理,涉及在Windows和Linux两个系统平台上,一个应用程序在编译、链接和运行时刻所发生的各种事项,包括:代码指令是如何保存的,库文件如何与应用程序代码静态链接,应用程序如何被装载到内存中并开始运行,动态链接如何实现,C/C++运行库的工作原理,以及操作系统提供的系统服务是如何被调用的。每个技术专题都配备了大量图、表和代码实例,力求将复杂的机制以简洁的形式表......一起来看看 《程序员的自我修养》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具