Other PDF Issues

How to Send a PDF as Multipart Form Data with Acrobat Net.HTTP

Rana GarciaRana Garcia Nov 10, 2026 868 views

Question details

The user needs to submit a PDF stream created via Collab.documentToStream as a multipart/form-data request using the Acrobat Net.HTTP API.

How to Send a PDF as Multipart Form Data Using Acrobat Net.HTTP
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Constructing an Acrobat JavaScript snippet to stream a local PDF document to an external server via an HTTP POST request.
Observed behavior
Acrobat JavaScript implements significant security and API limitations, preventing the easy construction of multipart/form-data requests with arbitrary file streams.
Before you start

Verify whether you have administrative access to the destination server, as bypassing client-side JavaScript limitations often requires modifying how the server endpoint receives data.

Solution 1Recommended

Modify the Server Endpoint to Accept Raw PDF Streams

Adjust your server-side script to accept a raw binary data stream instead of requiring a multipart/form-data structure, which circumvents Acrobat's API limitations.

Because Acrobat's Net.HTTP API heavily restricts how multipart payloads can be constructed and attached, forcing a multipart structure from the client side is often unreliable. Sending the raw PDF stream directly is the most stable workaround.

1
Extract the document stream

Use the Collab.documentToStream() method in your Acrobat JavaScript to generate the raw binary stream of the current PDF document.

2
Configure the Net.HTTP request

Set up your Net.HTTP.request call to send the raw binary stream directly in the body of a POST request, rather than trying to construct form boundaries.

3
Update the server script

Modify your receiving backend (e.g., PHP, Node.js) to read the raw request body. For instance, in PHP, use file_get_contents('php://input') to read the stream and save it with a .pdf extension.

Stream Efficiency: Using raw streams reduces payload overhead compared to Base64 encoding or multipart boundaries, resulting in faster and more reliable file transfers.
Free Microsoft Office alternative

Simplify Document Management with WPS Office

Dealing with strict JavaScript API limitations and complex HTTP workarounds in traditional PDF editors can interrupt your workflow. WPS Office provides a lightweight, highly compatible alternative for managing PDFs and Office documents effortlessly without requiring complicated custom scripting.

  1. 1. Download the software: Visit the official WPS Office website and download the free installer for your operating system.
  2. 2. Install the suite: Run the setup file and follow the standard installation prompts to install the comprehensive office suite.
  3. 3. Manage your documents: Open your PDFs or Microsoft Office files directly in WPS Office to enjoy a hassle-free, secure document editing experience.
Built-in PDF tools for seamless viewing, editing, converting, and sharing.Fully compatible with Microsoft Office formats (Word, Excel, PowerPoint) and standard PDFs.Lightweight architecture ensuring fast loading times and smooth performance.Intuitive user interface that makes transitioning simple and straightforward.
microsoft office alternative - wps office

Frequently Asked Questions

Why does Acrobat Net.HTTP limit multipart/form-data uploads?

Acrobat JavaScript implements strict security sandboxing to prevent malicious documents from secretly capturing user data, accessing local files, or executing unauthorized HTTP requests to external servers.

Can I encode the PDF to Base64 before sending?

Yes, you can theoretically encode the stream to Base64 and send it as a standard JSON or form field payload. However, this increases the file size by roughly 33% and can cause memory issues within Acrobat for larger PDF documents.

Is Collab.documentToStream the only way to get PDF data?

Collab.documentToStream is the standard Acrobat API method for retrieving the document's binary stream. Alternatively, for simple data extraction, you can export form field data (FDF/XFDF) directly using the doc.submitForm() method, which natively supports HTTP submissions.