DocSpring vs HexaPDF

Compare filling named AcroForm fields in Ruby with placing fields on any PDF in a browser.

Our take

HexaPDF is the most complete pure-Ruby PDF library. It reads and writes PDFs, fills and flattens AcroForm fields, merges, optimizes, encrypts, and can build documents with its own layout engine. If your PDFs already have properly named form fields and your app is Ruby, filling them with HexaPDF is a few lines.

The limits show up fast in practice. Most PDFs that customers send you have no fields, or have fields with names like Text12 that nobody wants to map in code. HexaPDF cannot render HTML, has no editor, and its AGPL license means a commercial license for closed-source use. DocSpring fills any PDF, fielded or flat, from a visual editor, renders HTML templates, and adds forms and signing. Choose HexaPDF for in-process Ruby manipulation of well-formed PDFs. Choose DocSpring when the PDFs are messy, the layouts change, or you need more than filling.

Fields you have versus fields you need

HexaPDF works with the structure inside a PDF. When a document contains AcroForm fields, you look them up by name, set values, and optionally flatten. It also creates fields, so you can build fillable forms in code. Its layout engine composes text, columns, and images for documents you generate from scratch.

DocSpring works with the page as you see it. Upload any PDF, and if it has fields DocSpring imports them with their positions. If it does not, drag fields where they belong. Either way the template is versioned, the API validates your JSON, and the same platform handles HTML templates, web forms, and signatures.

Choose DocSpring for flat PDFs, changing forms, and non-developers

Your PDFs come from customers or agencies and rarely have usable fields. You want people outside engineering to fix a misaligned field, and you want hosted rendering, storage, webhooks, and signing.

Choose HexaPDF for in-process PDF manipulation in Ruby

Your PDFs have named fields, your stack is Ruby, you want to fill, merge, or optimize PDFs without a network call, and the AGPL or a commercial license works for you.

Feature comparison

Follow the feature links for details in DocSpring's documentation. Sources for each HexaPDF cell are listed at the end of the page.

Available Not available Limited or your responsibility

Scroll the table sideways to see both products.

HexaPDF and DocSpring: filling PDFs, layouts, licensing, and operations
What you need DocSpring HexaPDF
Templates
Fill an existing PDF Yes Overlay fields on your PDF. Import existing form fields or place your own. Conditions apply: AcroForm fields only Fills existing AcroForm fields by name and can flatten them. Flat PDFs without fields need fields created in code at measured coordinates.
Visual document design No Use an existing PDF or write HTML/CSS. The field editor does not design the document layout. No No editor. Field names and any new field positions live in Ruby code.
HTML to PDF Yes HTML/CSS and Liquid templates, with code editors and a PDF preview. No No HTML or CSS rendering. Its layout engine uses its own Ruby API for text, columns, and images.
Repeat a list of items Yes Liquid loops create growing tables in HTML templates. Fields on an uploaded PDF can address array items without changing the page layout. Yes Ruby loops with the layout engine's boxes and columns for repeated content.
Conditional content Yes Show or require PDF fields with conditional rules. Use Liquid conditions for HTML content. Yes Any Ruby conditional.
Template versioning Yes Edit drafts, publish numbered versions, and pin API requests to a version. Conditions apply: Your responsibility Field mappings and layout code are versioned by your repository.
Editable PDF output Yes Keep text and checkbox fields editable, or flatten the filled content. Yes Fill fields and leave them editable, or call flatten to fix the values into the page.
API integration
Synchronous generation Yes Use sync.api.docspring.com to receive submission JSON and a PDF download URL in one request. Yes Runs in your process and writes the PDF.
Asynchronous generation Yes Send wait=false to return immediately. Receive a webhook or check the submission status later. Conditions apply: Your responsibility Background processing is your job queue.
Webhooks Yes Receive notifications about PDF generation and Data Request events. No Nothing to notify; it is a library call.
Batch PDF generation Yes Generate up to 50 PDFs in a request with different templates and data. Conditions apply: Your responsibility Loop in Ruby inside your workers.
Combine PDFs Yes Combine generated PDFs and other PDF files into one document. Yes Imports pages from other documents to merge and split PDFs.
Forms and e-signatures
Embed the template editor Yes Embed the PDF field editor and choose which controls your users can access. No No editor exists.
Collect data with forms Yes Generate web forms from your PDF template fields, or let people fill in the PDF visually. No Creates fillable PDFs but does not host a web form or collect submissions.
Electronic signatures Yes Data Requests support ESIGN/UETA signing workflows. Your app supplies authentication details and sends notifications. Conditions apply: Digital signatures only Applies cryptographic PDF signatures with a certificate. There is no signer workflow, identity check, or audit trail of who signed when.
Security and deployment
SOC 2 Type II Yes Completed audit. Request the report through our Trust Portal. Conditions apply: Your responsibility The library has no audit. Your hosting and processes determine compliance.
HIPAA compliance Yes HIPAA compliant. Sign a BAA before submitting protected health information; contact [email protected]. Conditions apply: Your responsibility Documents stay in your infrastructure. The controls are yours to prove.
Automatic document deletion Yes Set an expiry per template for submission data, generated PDFs, and uploaded images. Conditions apply: Your responsibility Output goes wherever your code writes it.
US and EU hosting Yes Choose the US or EU service region. Conditions apply: Your responsibility Runs wherever your Ruby application runs.
Self-hosting Yes: Enterprise Self-hosted enterprise licenses are available. Yes Self-hosted only. AGPL 3.0, with a commercial license available from the author for closed-source use.

"Limited or your responsibility" marks things the library only partly covers or leaves to your own code and infrastructure. Plan requirements and product boundaries are noted in the cells.

Fill an application form with a name and email address

Suppose you have an application form as a PDF and your Ruby application knows the customer's name and email. Compare what happens when the PDF has fields, and when it does not.

In DocSpring

Upload the PDF. If it has fields, DocSpring imports them with their positions and you rename the two you need. If it does not, drag two text fields onto the page. Preview with sample data and publish.

Send the JSON from Ruby with the official client or plain HTTP, and receive the filled PDF's download URL. Later changes to the form are made in the editor.

In HexaPDF

If the PDF has AcroForm fields, open it, look each field up by name, set the values, optionally flatten, and write the file. This is the good case and it is genuinely short.

If the PDF is flat, you must create fields or draw text at coordinates you measure yourself, and maintain those numbers in code. Field names in real-world PDFs are often unhelpful, so expect a mapping table.

Fill the form with HexaPDF

This is the best case, where the PDF already has fields named customer_name and customer_email.

require 'hexapdf'

# Works when the PDF already contains AcroForm fields with known names.
doc = HexaPDF::Document.open('application.pdf')
form = doc.acro_form
form.field_by_name('customer_name').field_value = 'Mira Patel'
form.field_by_name('customer_email').field_value = '[email protected]'

# Optional: flatten the fields so the values become fixed page content.
form.flatten
doc.write('filled.pdf')

Fill the form with DocSpring

The same values sent as JSON. The field positions were set in the browser and work for flat PDFs too.

curl --fail-with-body \
  "https://sync.api.docspring.com/api/v1/templates/${DOCSPRING_TEMPLATE_ID}/submissions" \
  --user "${DOCSPRING_TEST_TOKEN_ID}:${DOCSPRING_TEST_TOKEN_SECRET}" \
  --header 'Content-Type: application/json' \
  --data '{
    "test": true,
    "data": {
      "customer_name": "Mira Patel",
      "customer_email": "[email protected]"
    }
  }'

Set the environment variables to your template ID and test API credentials. Accounts in our EU region send requests to sync.api-eu.docspring.com instead. The response includes a download URL for a watermarked PDF. See the request and response guide.

Open a few of the real PDFs your application receives and list their field names. If half of them have no fields or names like Text12, that is the mapping work HexaPDF leaves with you.

Open source with a commercial license, plus your own time

DocSpring

The Starter plan is $49 per month for 50 live PDFs, then 25c per additional PDF. Larger plans lower the per-PDF price. Every plan includes unlimited templates, users, and watermarked test PDFs, and there is a free trial with no card required.

See all DocSpring plans

HexaPDF

HexaPDF is AGPL 3.0. Using it inside a closed-source application generally requires a commercial license, sold by the author with pricing on the project site. Add the engineering time for field mapping and any coordinate work for flat PDFs.

For well-formed PDFs in a Ruby monolith, the total can be modest and the library is excellent value.

HexaPDF pricing page

Compare the commercial license plus a day of mapping work per messy PDF with a fixed monthly plan that includes hosted rendering, an editor anyone can use, and signing.

Moving from HexaPDF to DocSpring

Upload each PDF to DocSpring. Fielded PDFs import their fields and names, so your existing mapping mostly carries over as field names in the template. For flat PDFs, drag the fields into place instead of maintaining coordinates.

Replace the HexaPDF calls with a request through the DocSpring Ruby client. Choose per template whether output stays editable or is flattened. Keep HexaPDF if you still need in-process merging or encryption, or use DocSpring's combine PDFs API.

Test each form with long values and checkboxes, then remove the field-name mapping table from your code.

Discuss your documents with us.

Questions about HexaPDF and DocSpring

Can HexaPDF fill a PDF that has no form fields?

Only by creating fields or drawing text at coordinates you measure yourself. DocSpring's editor lets you place fields visually on any PDF, fielded or not, and imports existing fields when they are present.

Is HexaPDF free to use commercially?

HexaPDF is AGPL 3.0. Closed-source commercial use generally needs the commercial license offered by the author. Check the project site for current terms and prices.

Does DocSpring handle Ruby well?

Yes. DocSpring has an official Ruby client library, and the API is plain JSON over HTTPS. The template editor runs in the browser so non-developers can maintain templates.

About this comparison

We reviewed DocSpring's documentation and implementation alongside HexaPDF's published product, API, pricing, and security information. Prices and plan limits were checked on the review date shown at the top of the page. The workflows describe documented behavior; they are not performance benchmarks. Features and plans can change after the review date.

Sources

Spotted something that needs correcting? Send us the detail and a source.

Related comparisons

Product names, logos, and brands are the property of their respective owners and are used here for identification and comparison only. Their use does not imply any affiliation with or endorsement by those companies.

Upload a fielded or flat PDF and fill it from JSON

Upload a PDF or create an HTML template, then send a test request.

Start Free Trial