Can Acrobat JavaScript Merge PDFs from Login-Protected URLs?
Question details
The user wants to know if Acrobat JavaScript can securely authenticate, download, and merge a PDF from a password-protected URL into an existing form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Attempting to automate PDF merging by fetching a remote document from an external, login-protected website using a client-side script.
- Observed behavior
- Standard Acrobat JavaScript does not support secure logins to external websites for downloading protected documents directly.
Understand that local PDF JavaScript execution environments are highly restricted for security reasons to prevent unauthorized access to external networks, APIs, or user credentials.
Use a Server-Side Application or API for Authentication and Merging
Shift the download and merge process to a backend server that can securely handle authentication credentials and network requests.
Standard Acrobat JavaScript cannot securely bypass website authentication or scrape protected files directly. Instead of relying on client-side scripts inside the PDF viewer, you must handle the authentication, download, and document processing on a secure server.
Deploy a server environment (such as Node.js, Python, or PHP) capable of making authenticated HTTP requests to the target website.
Save your login credentials or API authentication tokens securely within the server's environment variables rather than embedding them in client scripts.
Configure your server script to authenticate with the remote URL and download the protected PDF document to your server's temporary storage.
Use a server-side PDF manipulation library (like PDF-lib, PyPDF2, or iText) to append the downloaded document to the first page of your existing form.
Push the newly merged PDF file back to the end user for viewing or downloading.

Easily Merge and Secure PDFs with WPS Office
While client-side scripts cannot securely automate downloads from protected URLs, you can easily download your files and merge them manually using the comprehensive built-in WPS PDF tool.
- 1. Open WPS Office: Launch the WPS Office application and navigate to the PDF tab.
- 2. Select Merge PDF: Click on 'Merge PDF' from the top toolbar or the dedicated PDF Tools menu.
- 3. Add Your Files: Upload the secure PDFs you have downloaded along with your existing form into the merge window.
- 4. Combine and Save: Arrange the page order as needed, click 'Merge', and save the newly combined document to your local drive.

Frequently Asked Questions
Can I include my username and password directly in the URL for JavaScript to access?
While technically possible on some unsecured basic-auth servers (e.g., http://user:pass@website.com), modern browsers and PDF viewers actively block this method for security reasons. Doing so also exposes your credentials in plain text to anyone who opens the PDF.
Why does Acrobat restrict JavaScript from accessing external URLs?
Acrobat implements strict security sandboxing to prevent malicious PDFs from quietly downloading malware, stealing local data, or executing unauthorized network requests without explicit user consent and trust configurations.
Are there any authorized APIs I can use in Acrobat for external access?
Acrobat provides certain SOAP and web service integrations via JavaScript, but they require complex configurations, trusted folder setups, and user-approved security policies. This makes them unsuitable for silent, automated external logins.




