How to Send a PDF as Multipart Form Data with Acrobat Net.HTTP
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.

- 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.
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.
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.
Use the Collab.documentToStream() method in your Acrobat JavaScript to generate the raw binary stream of the current PDF document.
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.
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.
Use Trusted Folder-Level Scripts for Local Save
Save the PDF locally using a trusted Acrobat function, then use an external application or script to handle the multipart upload.
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. Download the software: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install the suite: Run the setup file and follow the standard installation prompts to install the comprehensive office suite.
- 3. Manage your documents: Open your PDFs or Microsoft Office files directly in WPS Office to enjoy a hassle-free, secure document editing experience.

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.




