pdfcraft_form 1.1.3 copy "pdfcraft_form: ^1.1.3" to clipboard
pdfcraft_form: ^1.1.3 copied to clipboard

Form engine, expression evaluation, and data binding for the PDFCraft ecosystem.

pdfcraft_form #

pub package style: very good analysis License: MIT

Interactive AcroForm elements, dynamic data binding, and runtime expression evaluation engine for the PDFCraft ecosystem.


🌟 What is pdfcraft_form? #

pdfcraft_form brings dynamic logic and interactive fillable forms to your PDF documents. It enables developers to bind runtime JSON data objects (e.g., user profiles, invoice totals) into template fields dynamically and render fillable PDF form fields (text fields, checkboxes, dropdowns).

Key Capabilities: #

  • 📝 Interactive Form Elements: Render native fillable AcroForm text inputs, checkboxes, and select dropdowns inside generated PDFs.
  • 🔗 Dynamic Data Binding: Inject dynamic context (DataBinder) into template placeholders (e.g., {{customer.name}}).
  • 🧮 Expression Engine: Calculate expressions at runtime (e.g., {{item.price * item.quantity}}).

🚀 Getting Started #

Add pdfcraft_form to your pubspec.yaml:

flutter pub add pdfcraft_form pdfcraft_core pdfcraft_generator

💻 Human-Centric Usage Examples #

1. Evaluating Expressions and Data Binding #

Here is how human developers use ExpressionEngine and DataBinder to compute dynamic fields:

import 'package:pdfcraft_form/pdfcraft_form.dart';

void main() {
  final context = {
    'user': {'name': 'Jane Doe', 'role': 'Administrator'},
    'order': {'subtotal': 100.0, 'taxRate': 0.15},
  };

  // 1. Interpolate string placeholders
  final binder = DataBinder(context);
  final greeting = binder.bind('Hello, {{user.name}}! Role: {{user.role}}');
  print(greeting); // Output: Hello, Jane Doe! Role: Administrator

  // 2. Evaluate mathematical expressions dynamically
  final engine = ExpressionEngine(context);
  final totalTax = engine.evaluate('order.subtotal * order.taxRate');
  print('Calculated Tax: \$$totalTax'); // Output: Calculated Tax: $15.0
}

2. Rendering Interactive Form Fields in PDFs #

To render fillable PDF form fields, register form field renderers with your generator registry:

import 'package:pdfcraft_generator/pdfcraft_generator.dart';
import 'package:pdfcraft_form/pdfcraft_form.dart';

void registerFormPlugins() {
  // Register interactive form elements globally
  GeneratorRegistry.instance.register(TextFieldRenderer());
  GeneratorRegistry.instance.register(CheckboxRenderer());
  GeneratorRegistry.instance.register(DropdownRenderer());
}

🛠️ Supported Form Renderers #

Renderer Field Type PDF Output
TextFieldRenderer 'text_field' Native fillable PDF text entry box.
CheckboxRenderer 'checkbox' Native interactive PDF checkbox.
DropdownRenderer 'dropdown' Native interactive PDF select menu.

💖 Support the Project #

If you find this package useful, please consider supporting its development:


📄 License #

This package is released under the MIT License.

0
likes
150
points
253
downloads

Documentation

API reference

Publisher

verified publisherbytebunkers.in

Weekly Downloads

Form engine, expression evaluation, and data binding for the PDFCraft ecosystem.

Homepage
Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

ko-fi.com
www.paypal.com

License

MIT (license)

Dependencies

flutter, pdf, pdfcraft_core, pdfcraft_generator, petitparser

More

Packages that depend on pdfcraft_form