npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cnhis-frontend/signature

v1.0.3-beta.0

Published

手写板签名对接 sdk

Downloads

2

Readme

signature-sdk

手写板签名对接 sdk

厂商列表

  • 捷宇技术(默认)
  • 天谷信息
  • 河北腾翔

安装

yarn add @cnhis-frontend/signature

如何使用


import SignatureSDK from '@cnhis-frontend/signature'

// 创建签名实例,注意,重复创建也只会返回上一个实例对象

// 捷宇
const signatureSdk = SignatureSDK.create()
const { signImage, fingerImage, signXml, mixImage, signFileStr } =
	await signatureSdk.start(option)
/* option类型为undefined | {
	strokeWidth?: number; 签名线条粗细值,默认值 3
	pdfPath?: string; 预览目标pdf文件路径
	xmlPath?: string; xml文件生成路径,
	location?: string; 签名或者指纹的位置,一个签名或指纹标准格式为Type.Page.X.Y,默认值 '2.1.100.100'
						Type---------0为签名,1为指纹,2为指纹加签名
						Page---------表示页码
						X-------------坐标位置
						Y-------------坐标位置
						(比如只有一个签名时表示“0.1.100.100”)多个位置时用 “|”分隔符
	voiceStr?: string; 播放的提示语,默认值 '请签名'
	ifPreview?: number; 只签名或者签名 pdf 文件,2 为签名 pdf 文件, 1 为预览 pdf文件,0 为只签名或者只按指纹,此时 PDFPath 可以为空,默认值 0
}
signatureSdk.start方法返回值类型为 {
	signImage: string; 签名图片,base64
	fingerImage: string; 指纹图片,base64
	signXml: string; 签名轨迹 xmlbase64
	mixImage: string; 签名指纹合成图片 base64 [取值建议取这个]
	signFileStr: string; 成功后返回 pdf 的 base64 数据
}
*/

// 捷宇-四川CA
const signatureSdk = SignatureSDK.create({name: 'jieyu', version: 'sichuan'})
const { signImage, fingerImage, SignPdfBase64, XML } =
	await signatureSdk.start(option)
/* option类型为undefined | {
	SignWidth?: number; 签名图片宽度值,默认值 50
	PDFPath: string; 目标pdf文件路径
	XmlPath?: string; XML文件生成路径(为空时表示点击屏幕签名,传 xml 路径时表示指定位置签名),
	Location?: string; 签名或者指纹的位置,一个签名或指纹标准格式为Type,Page,X,Y,默认值 '2,1,450,500'
						Type---------0为签名,1为指纹,2为指纹加签名
						Page---------表示页码
						X-------------坐标位置
						Y-------------坐标位置
						(比如只有一个签名时表示“0,1,100,100”)多个位置时用 “|”分隔符
	Retain?: string; 预留项
	Timeout?: number; 超时时间,默认值 60s
}
signatureSdk.start方法返回值类型为 {
	signImage: string[]; 签名图片,base64, 由于可多次点击屏幕签名,所以可生成多个签名图 [如存在同时签名和指纹,则此值为签名+指纹合并图,否则仅为签名图,取值建议取这个]
	fingerImage: string[]; 指纹图片,base64, 由于可多次点击屏幕签名,所以可生成多个签名图
	SignPdfBase64: string; pdf 的 base64
	XML: string; 如果是点击屏幕签名返回 json 集合,json 说明(XMLCount---xml 个数,XML+序号-----xml 的数据)
}
*/

// 天谷
const signatureSdk = SignatureSDK.create({ name: 'tiangu' })
// 签名图片,base64
const { signImage } = await signatureSdk.start('sign')
// 指纹图片,base64
const { fingerImage } = await signatureSdk.start('finger')

// 河北腾翔(signImage包含了手写签名和指纹)
const signatureSdk = SignatureSDK.create({ name: 'tengxiang' })
// 签名图片,base64,signImage包含了手写签名和指纹
const { signImage } = await signatureSdk.start(option)
/* option类型为undefined | {
	content?: string; 签名原文,默认为空
	zoomSize?: number; (0 – 100)表示输入图案为原图的百分比,0表示不缩放,默认25
} */

// 河北腾翔3.0(signImage包含了手写签名和指纹)
const signatureSdk = SignatureSDK.create({ name: 'tengxiang', version: 3 })
// 签名图片,base64,signImage包含了手写签名和指纹
const { signImage } = await signatureSdk.start(option)
/* option类型为 {
	id?: string | number; 业务系统自定义字段,可以定义多个,证信签不对其进行处理,签字完成时一并返回
	reason: string; 签字确认文字
	title: string; 标题
	content: string; type为html时为网页源码(源码的双引号用单引号替换,其它不变),type为text的时候为string字符串(可传入有效url)
	source: string; 待签原文,PC传递给证信签,用于签名
	type?: 'text' | 'html' | 'htmlB64'; 默认值为text
} */

// 销毁实例,执行后可使用SignatureSDK.create()创建一个新实例
SignatureSDK.destroy()
/*
  1、关闭websocket连接
  2、销毁实例
  */