Web-Based PDF Editing: Implementation for Electronic Contract Platform

The article describes how Bilibili built a custom web‑based PDF editor for its electronic contract platform, replacing costly commercial tools with a schema‑driven architecture that provides drag‑and‑drop editing, business‑specific components, real‑time property panels, and robust undo/redo via a Vuex‑immutable store.

Bilibili Tech
Bilibili Tech
Bilibili Tech
Web-Based PDF Editing: Implementation for Electronic Contract Platform

This article introduces the implementation of web-based PDF editing capabilities from both business scenarios and technical perspectives. The context is Bilibili's electronic contract platform, which aims to move traditional offline paper contract signing processes online.

The article begins by explaining the business background, where the platform handles electronic signing for various Bilibili scenarios. A typical signing process involves uploading a PDF contract template containing form fields, which parties fill out and then apply electronic signatures to create legally binding contracts.

The author identifies problems with using commercial PDF editors like Adobe Acrobat Pro DC and Foxit PDF Editor, including licensing costs, inability to meet specific business customization needs, inconsistent styling, lack of platform constraints, and high maintenance costs for business partners.

To address these issues, the article proposes a customized web-based PDF editor tailored to Bilibili's signing scenarios. This approach standardizes the process by encapsulating complex business rules within the platform, providing users with a simple, limited set of necessary functions that improve both system stability and user experience.

The implemented editor consists of three main panels: a canvas panel for in-place editing (drag, resize, edit default values, delete, select, copy-paste), a left-side component list panel providing basic editable components (text forms, checkboxes, selects, plain text) and business-customized components (company names, phone numbers, seal positions, OA review information), and a right-side property editing panel for real-time parameter adjustments and fine-tuning.

The technical architecture is built around a schema layer that describes all editing information, where the relationship is: original PDF + schema data = synthesized PDF. This schema serves as a single store for global state management, enabling features like secondary editing, workspace recovery, undo/redo functionality, and extensibility.

The data flow follows a single store and unidirectional pattern, ensuring that component panels, property panels, canvas, and PDF generator have no direct data flow or coupling mechanisms, only interacting through the store. This design supports modular, pluggable capabilities.

For undo/redo functionality, the article implements a Vuex plugin using immutable.js to maintain state history, allowing pointer-based navigation through state objects. The plugin includes a

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Bilibili Tech
Written by

Bilibili Tech

Provides introductions and tutorials on Bilibili-related technologies.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.