DocSpring vs HexaPDF

Compare filling named AcroForm fields in Ruby with letting DocSpring find and name the fields on any PDF.

Our take

HexaPDF is the most complete pure-Ruby PDF library, and it is actively developed. It reads and writes PDFs, fills and flattens AcroForm fields, merges, optimizes, encrypts, signs with certificates, 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. Many 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 buying a commercial license for closed-source use. DocSpring finds the fields on any PDF you upload, fielded or flat, and AI names them, sets their types, and adds conditional logic for you to review. It also renders HTML, Word, and page design templates, and adds web forms and signature requests. 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, tables, lists, columns, and images for documents you generate from scratch, and it applies certificate-based digital signatures.

DocSpring works with the page as you see it. Upload any PDF. If it has fields, DocSpring imports them with their positions, and keeps their names or lets AI rename them. If it does not, DocSpring finds them on the page and AI names them. AI also sets their types, groups repeated rows into lists, and adds conditional logic, and you review it all in the editor. The template is versioned, the API validates your JSON, and the same account handles HTML, Word, and page design templates, web forms, and signature requests.

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

Your PDFs come from customers or agencies and rarely have usable fields. You want the fields found and named for you, people outside engineering to fix a misaligned one, and hosted rendering, delivery to your 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, sign, 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 its form fields, let AI find and name them, 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. XFA forms are not supported.
Visual document design Yes Build a PDF on a blank page in the Page Designer, with text, images, tables, charts, QR codes, barcodes, fillable form fields, headers and footers. An AI assistant can build one too, through the MCP server. 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, tables, columns, and images.
Repeat a list of items Yes Tables and repeating sections in page designs, and Liquid loops in HTML and Word templates, carry on over as many pages as they need. Fields on an uploaded PDF can address array items. Yes Ruby loops with the layout engine's table, list, and column boxes for repeated content.
Conditional content Yes Show or require PDF fields with conditional rules. Use Liquid conditions in page designs, HTML and Word templates. Yes Any Ruby conditional.
Template versioning Yes Edit drafts, see what changed since the last version, publish numbered versions, and pin API requests to one. Conditions apply: Your responsibility Field mappings and layout code are versioned by your repository.
Editable PDF output Yes Keep a PDF template's text and checkbox fields editable, or flatten the filled content. Page designs can add fillable text fields, checkboxes, radio buttons and drop-downs. 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 signature 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 template editor on any paid plan, from Starter, for PDF, Word, page design and HTML templates, and choose which controls your users can access. No No editor exists.
Collect data with forms Yes Every template gets a web form you can share or embed, and a PDF template can also be filled in on the page. No Creates fillable PDFs but does not host a web form or collect submissions.
Electronic signatures Yes Signature requests support ESIGN/UETA signing workflows on every plan, live once your account has made a payment. Signers sign in order or all at once. Conditions apply: Digital signatures only Applies cryptographic PDF signatures with a certificate, and can add long-term validation data. 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, with a BAA on every paid plan, including Starter. Sign it before sending health records. 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, or a commercial license per host per year 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 keeps their names or lets AI rename them. If it does not, DocSpring finds the fields on the page and AI names them. Check the two you need, 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.

Ruby
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 = 'mira@example.com'

# 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.

Shell
curl --fail-with-body \
  "https://sync.api.docspring.com/api/v2/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": "mira@example.com"
    }
  }'

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 free Developer plan includes 200 credits a month. Paid plans start with Starter at $49 a month for 10,000 credits. A filled PDF form costs 20 credits (9.8¢ on Starter), a PDF from an HTML template or a page design 4, a Word document 20, and each person who signs a signature request 60; longer documents cost more, and keeping documents for more than 30 days uses a few storage credits a month. Larger plans lower the price to 0.9¢ per filled PDF form, unused paid-plan credits roll over for 12 months, and credit packs top up any plan. Every plan includes e-signatures, every paid plan includes the embedded template editor and a HIPAA BAA, and you can try a paid plan's features free for 14 days without a card.

See all DocSpring plans

HexaPDF

HexaPDF is AGPL 3.0, which also applies when people use your application over a network, so a closed-source web app generally needs a commercial license. It is a yearly subscription for each production host, €600 a year for a physical server or €300 a year for a virtual machine such as a cloud instance, and an unlimited license is priced on request. Development, test, and CI hosts are included, and you can keep using the versions released during the year you paid for.

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

For 1,000 filled forms a month on one cloud server, HexaPDF's commercial license is €300 a year, whatever the volume. On DocSpring, 1,000 filled PDF forms a month need the Starter plan with 20,000 credits, at $89 a month, so HexaPDF is much cheaper to license. The difference is the mapping work for messy PDFs, and the editor, storage delivery, and signing that you would build yourself.

Moving from HexaPDF to DocSpring

Upload each PDF to DocSpring. Fielded PDFs import their fields, and you can keep their names, so your existing mapping carries over as field names in the template, or let AI rename them. For flat PDFs, DocSpring finds the fields and AI names them, so you check their names instead of maintaining coordinates.

Replace the HexaPDF calls with a request through the DocSpring Ruby client. Choose per request, or per field in the editor, whether output stays editable or is flattened. Keep HexaPDF if you still need in-process merging or certificate signatures, 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. If you fill common forms such as tax or insurance forms and your account is in DocSpring's US region, look in the Form Library first. Its forms are set up already, and DocSpring keeps them up to date.

Discuss your documents with us.

Questions about HexaPDF and DocSpring

Ask us about your documents

Can HexaPDF fill a PDF that has no form fields?

Only by creating fields or drawing text at coordinates you measure yourself. DocSpring finds the fields on a flat PDF when you upload it, AI names them, and you adjust them in a visual editor. It imports existing fields when they are present.

Is HexaPDF free to use commercially?

HexaPDF is AGPL 3.0, including when your application is used over a network. Closed-source commercial use generally needs a commercial license, sold per production host per year at €600 for a physical server or €300 for a virtual machine, with unlimited licenses priced on request. Check the author's site for current terms.

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.

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 a Word document, design a page, or write HTML, then send a test request. No credit card needed.

Product news by email

New features and changes, once a month.