1.0.1 • Published 11 months ago

quick-seal v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

安装

npm i --save quick-seal

基本使用

import QuickSeal from 'quick-seal'

// 实例化对象
const seal = new QuickSeal({
    fontFamily: 'SimSun', // 字体名称
    text: '浙江某某网络科技有限公司', // 主体文案
    code: '1234567890123', // 圆形章防伪码
    horizontal: '某某专用章', // 横排字
    color: 'green', // 颜色
    need5Start: true, // 是否需要五角星
    innerLine: true, // 是否需要内圈
    outType: 'Base64', // 函数调用输出类型 'Base64' | 'Blob' | 'File'
    // outSize: '180,180' // 调整输出的图片大小 默认不调整
})

// 实例对象 修改配置项
seal.updateConfig({
    fontFamily: 'SimSun', // 字体名称
    text: '浙江某某网络科技有限公司', // 主体文案
    code: '1234567890123', // 圆形章防伪码
    horizontal: '某某专用章', // 横排字
    color: 'green', // 颜色
    need5Start: true, // 是否需要五角星
    innerLine: true, // 是否需要内圈
    outType: 'Base64', // 函数调用输出类型 'Base64' | 'Blob' | 'File'
    outSize: '180,180'
})

const onDraw = async () => {
    // 可加载外部字体包并使用该字体 (注*请确认你的项目对该字体拥有授权)
    await seal.loadFont({ url: 'fontUrl', name: 'fontName' })
    // 绘制圆形章
    const fileCircular = await seal.drawCircular()
    // 绘制椭圆章
    const fileEllipse = await seal.drawEllipse()
}

示例效果图

版本更新日志

v1.0.1 => 新增配置项:outSize => 调整输出的图片大小
          文件输出修改为异步调用  
v1.0.0 => 正式版发布
1.0.1

11 months ago

1.0.0

11 months ago