Library / SDK
xxss0903/drawstamputils avatar
xxss0903/drawstamputils

drawstamputils: Browser-Based Electronic Stamp Editing

Draw Stamp Utils with Javascript

1,625 stars681 forksTypeScriptApache-2.0

At a glance

What is it?
drawstamputils is a TypeScript library and Vue demo for composing electronic stamps on a browser canvas, exporting images, and saving JSON templates. It fits client-side design workflows, but it is not a backend service, document-signing system, or documented production bundle.
Who is it for?
Adopt drawstamputils when the required output is a configurable stamp rendered locally in a browser canvas. Do not select it as a complete stamp-extraction, document-signing, or server-side seal system.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 119 days ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 22, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The Canvas and JSON Problems drawstamputils Addresses

drawstamputils addresses the rendering and editing side of electronic stamp production. It gives an application a canvas-oriented TypeScript class for drawing company names, stamp type text, inner circles, stars or images, security patterns, rough edges, and aging effects. The included Vue 3 application turns that class into an editor with a three-column workspace: elements on the left, a live canvas in the center, and selected element properties on the right.

The intended users are developers embedding stamp composition into a browser application, as well as people evaluating the local editor Demo. The README states that all Demo interaction happens in the browser and that the current version sends no requests to a server. Template import, image export, canvas editing, and configuration changes therefore fit workflows where the graphic remains on the client during composition.

This is a visual generator, not a document-signing implementation. Nothing in the README describes cryptographic signatures, certificates, identity verification, PDF signing, audit trails, or a trusted timestamp. It also should not be confused with stamp extraction. The maintainers moved that capability into the separate `extractstamp` project and link to it as the place for obtaining stamps from existing images.

DrawStampUtils Rendering and Configuration Flow

The library's central object is `DrawStampUtils`. Its constructor receives a canvas element and a millimeter-to-pixel conversion value. After the object is created, `refreshStamp()` renders the current configuration. Configuration can then be changed through the exposed object or through the Vue Demo, which translates property edits into a new canvas rendering.

Configuration is structured rather than represented by one large collection of unrelated flags. The README lists `ISecurityPattern`, `ICompany`, `ICode`, `ITaxNumber`, `IAgingEffectParams`, `IRoughEdge`, `IStampType`, and `IDrawStar` as major groups. It also documents list-based elements such as `companyList`, `stampTypeList`, and `innerCircleList`. These groups cover geometry and appearance, including font selection, compression, positioning, circle radii, line widths, noise strength, and rough-edge probability.

The star group can either draw a built-in star or use an image through `useImage` and `imageUrl`. Image sizing is expressed in millimeters, with separate width and height plus `keepAspectRatio`. The aging configuration includes a `seed`, which provides an application with a reproducibility parameter for noise generation when the renderer applies it consistently.

Template loading and saving operate on the complete configuration returned by `getDrawConfigs()`. The application serializes that object as JSON and later parses it before calling `setDrawConfigs()`. According to the README, loading the parsed object updates the stamp and redraws it immediately.

Installing drawstamputils and Starting Its Vue Demo

For an existing npm project, the README gives `drawstamputils` as the package to install:

bash
npm install drawstamputils

To inspect the Demo from the repository, clone it and install the package dependencies:

bash
git clone https://github.com/xxss0903/drawstamputils.git
cd drawstamputils
npm install

The repository is an ES module project with Vite scripts. Start its local development server with:

bash
npm run dev

The README does not state the development server address printed by Vite, so a fixed port cannot be assigned from the documentation. For a production build, use the documented script:

bash
npm run build

`package.json` maps this command to `vite build`. The generated output can be inspected through:

bash
npm run preview

The application entry is `src/App.vue`, which renders `src/components/editor/StampWorkspace.vue`. A useful first check is whether the center canvas appears. Edit a property in the right panel and confirm that the stamp changes without a backend request. The README identifies Vite as the mechanism but does not document a separate library integration test.

Creating, Saving, and Reloading a Stamp

The shortest documented library flow creates a renderer around an existing canvas and immediately calls `refreshStamp()`:

typescript
const drawStampUtils = new DrawStampUtils(canvasRef, MM_PER_PIXEL)
drawStampUtils.refreshStamp()

The README asks the caller to replace `canvasRef` with its canvas element and `MM_PER_PIXEL` with the conversion appropriate for the application. The documentation does not establish defaults for either value, so omitting them is not a documented setup path.

To save a configuration, obtain it from the renderer and serialize it:

typescript
const drawConfigs = drawStampUtils.getDrawConfigs()
const jsonStr = JSON.stringify(drawConfigs, null, 2)

This produces a JSON representation containing the configurable groups documented by the README. Loading requires the application to read a file into a string, parse it, and pass the parsed value to `setDrawConfigs()`:

typescript
const jsonStr = await readTemplateFile()
const configs = JSON.parse(jsonStr)
drawStampUtils.setDrawConfigs(configs)

`readTemplateFile` is explicitly described as a caller-defined method, not a documented `drawstamputils` export. The Demo supplies a concrete local file interface. The README does not define template versioning or migration behavior, so consumers should not assume that every later configuration change will preserve old templates.

Local Export, Images, Fonts, and Browser Limits

The Demo's download control opens format and resolution settings, then offers PNG, JPEG, or SVG with an embedded PNG. Its template controls import local `.json` files and export the current configuration. This keeps the editor suitable for applications that require local asset handling, but browser behavior still matters. Canvas tainting, image loading, font availability, SVG serialization, and export resolution can affect results. The README does not provide compatibility requirements for those cases.

Fonts are selected through configuration keys such as `fontFamily`, so a machine without the selected font may render differently. The documentation does not state whether font files are embedded or whether the library loads web fonts. Likewise, `imageUrl` is described only as an image URL. The README does not define whether local data URLs, object URLs, and remote URLs have different loading or security behavior.

The statement that the Demo makes no server requests describes the included interface. It should not be interpreted as a blanket guarantee about every possible `imageUrl` supplied by a consuming application. An application that passes a remote image URL would still need to account for that URL's origin, loading policy, and network behavior.

The repository also lists a macOS DMG release for version `0.2.5`, dated 2025-05-16, but the README installation path uses npm and the repository Demo uses Vite. The release packaging procedure is not documented, so the macOS artifact should not be treated as the recommended setup for library consumers.

Package Shape, Licensing, and Upgrade Constraints

The package metadata identifies `src/DrawStampUtils.ts` as `main` and sets `"type": "module"`. That is an important integration detail. Consumers importing TypeScript source may need a compatible build pipeline, and the README does not document transpiled JavaScript, declaration files, browser bundles, or framework-specific entry points. This makes the repository clear as a source-level example, but less clear as a distribution that can be added without checking the consuming build.

The license is `Apache-2.0`. The README identifies the project as Apache licensed, and the repository contains a `LICENSE` file. Teams should read that file and any included notices when redistributing code or shipping a product. This article does not provide legal advice about a particular application or distribution model.

The repository is not archived, and its last push was on 2026-06-26. That indicates recent development activity, but it does not establish a release cadence or compatibility policy. One listed release is `0.2.5`, published on 2025-05-16, while `package.json` also reports version `0.2.5`. The README does not describe an upgrade process, supported-version range, or migration guide.

Upgrade work can therefore include reviewing template structure, checking changes to canvas output, and validating local imports and exports. Applications that depend on exact fonts or image sizing need particular attention because reproducible output depends on assets available in the rendering environment.

Editorial conclusion

Adopt drawstamputils when the required output is a configurable stamp rendered locally in a browser canvas. Do not select it as a complete stamp-extraction, document-signing, or server-side seal system. Verify first that importing `src/DrawStampUtils.ts` through your TypeScript build produces a usable package, because `package.json` points directly to source and the README does not document a bundled entry point.

Frequently asked questions

How do I install drawstamputils in a JavaScript or TypeScript project?

The README gives `npm install drawstamputils`. It does not document a separate bundled entry point, although `package.json` points `main` at `src/DrawStampUtils.ts`.

Can drawstamputils save and reload stamp templates?

Yes. Use `getDrawConfigs()` to obtain the configuration, serialize it as JSON, parse a loaded JSON string, and pass it to `setDrawConfigs()`. The Demo also provides local import and export controls.

Does drawstamputils extract a stamp from an existing image?

The README says extraction has moved to the separate `extractstamp` project. It still shows an `extractStampWithFile` example, but directs users to `extractstamp` for extraction.

Official sources

  1. Issues
  2. License: Apache-2.0
  3. README
  4. Releases
  5. xxss0903/drawstamputils on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/xxss0903-drawstamputils.svg)](https://hysenlabs.com/projects/xxss0903-drawstamputils)

Was this useful?