PDF Conversion Issues

Export the Current PDF Page to Word or Excel with Acrobat JavaScript

Phi Hung VoPhi Hung Vo Nov 2, 2026 869 views

Question details

The user wants to use an Acrobat JavaScript script to isolate the current page of a PDF and export it directly into a Word or Excel format.

Export the Current PDF Page to Word or Excel using Acrobat JavaScript
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Automating the extraction of a single viewed PDF page and converting it into an editable document format without processing the entire file.
Observed behavior
The user requires a scripted method to handle both page extraction and file conversion sequentially.
Before you start

Ensure you are using a premium version of Adobe Acrobat, as Acrobat Reader does not support the extraction and conversion methods via JavaScript. Also, verify that the document's security settings permit page extraction.

Solution 1Recommended

Use a Two-Step JavaScript Process to Extract and Save

Since Acrobat cannot convert a partial document in one command, you must first extract the page into a temporary document and then save that new document with a conversion parameter.

To achieve this, the script must perform two distinct actions: extracting the currently viewed page to create a new PDF object, and then invoking the save method on that new object using the correct file-conversion handler.

1
Determine the current page number

Acrobat JavaScript uses zero-based indexing for pages. You can identify the currently active page using the property `this.pageNum`.

2
Extract the specific page

Use the `this.extractPages()` function to pull out the current page. For example: `var newDoc = this.extractPages({nStart: this.pageNum, nEnd: this.pageNum});`

3
Save as Word or Excel

Call the `saveAs()` method on the newly created document object and pass the appropriate conversion ID. Use `"com.adobe.acrobat.docx"` for Microsoft Word or `"com.adobe.acrobat.xlsx"` for Microsoft Excel. Example: `newDoc.saveAs({cPath: "/c/temp/export.docx", cConvID: "com.adobe.acrobat.docx"});`

4
Close the temporary document

Clean up the background process by closing the extracted document without saving the PDF version. Use `newDoc.closeDoc(true);`.

Use a Two-Step JavaScript Process to Extract and Save
Privilege Requirements for saveAs: The saveAs function is a restricted method. To run this script without throwing a security exception, it typically must be executed from a privileged context, such as a trusted folder-level script or via the Action Wizard.
Convert PDF Pages Easily

Convert PDF Pages to Word or Excel without Coding in WPS Office

If writing JavaScript requires too many security workarounds or you do not have Acrobat Pro, WPS Office provides an incredibly simple, built-in feature to extract and convert specific PDF pages to Word or Excel instantly.

  1. 1. Open your PDF in WPS Office: Launch WPS Office and open the PDF document containing the page you want to export.
  2. 2. Select the Conversion Tool: Navigate to the 'Tools' tab and click on either 'PDF to Word' or 'PDF to Excel' depending on your required output format.
  3. 3. Specify the Page Number: In the conversion dialog box, look for the 'Page Range' option. Select 'Custom' and enter the specific page number you are currently viewing.
  4. 4. Start the Conversion: Click the 'Convert' button. WPS Office will process only the selected page and immediately open your new, editable Word or Excel file.
Select and convert specific page ranges visually with just a few clicks.Ensures strict format compatibility with Microsoft Word (.docx) and Excel (.xlsx) formats.Bypasses the need for complex JavaScript programming or modifying software security policies.Features a lightweight, intuitive interface familiar to all Office users.
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a NotAllowedError when running doc.saveAs()?

Acrobat restricts the saveAs function for security reasons to prevent malicious scripts from writing files to your hard drive automatically. To bypass this, the script must be executed as a privileged context, such as a trusted folder-level script.

What are the exact conversion IDs for Word and Excel in JavaScript?

For Microsoft Word documents (.docx), the identifier is "com.adobe.acrobat.docx". For Microsoft Excel workbooks (.xlsx), it is "com.adobe.acrobat.xlsx".

Do I need Adobe Acrobat Pro to execute this script?

Yes, page extraction (extractPages) and advanced file-conversion scripts require Adobe Acrobat Pro or Standard. The free Acrobat Reader cannot execute these specific document-altering methods.

Can I convert multiple non-continuous pages at once using JavaScript?

Yes, but you will need to extract the pages individually or in specific ranges, compile them into a single temporary PDF document using doc.insertPages(), and then use the saveAs command on that compiled document.