@groupdocs/groupdocs.conversion
v25.11.0
Published
Document conversion API for Node.js (powered by Java) to convert back and forth between the most popular document and image formats, including PDF, Word, Excel, PowerPoint, OpenDocument documents, e-mail messages, images and many more in one package.
Downloads
235
Readme
Document conversion API for Node.js (powered by Java) to convert back and forth between the most popular document and image formats, including PDF, Word, Excel, PowerPoint, OpenDocument documents, e-mail messages, images and many more in one package.
Quick links
Key Features
- Convert whole documents to desired target formats.
- Convert specific document page(s) or page ranges.
- Auto-detect source document format on the fly without requiring the file extension.
Supported Formats
Documents & Office
- PDF: PDF (versions 1.3, 1.4, 1.5, 1.6, 1.7)
- Word Processing: DOC, DOCM, DOCX, DOT, DOTM, DOTX, MD, RTF, TXT
- Spreadsheet: XLS, XLSX, XLSB, XLTX, XLTM, XLSM, CSV, NUMBERS, ODS
- Presentation: PPT, PPTX, PPS, PPSX, POTM, POTX, POT, PPSM, PPTM
- OpenOffice: ODS, ODP, OTP, ODT, OTT
Other Formats
- Images: JPG, PNG, SVG, BMP, GIF, AI, DJVU, ICO, TIFF
- CAD: CF2, DGN, DWFX, DWT
- Compression: 7Z, GZIP, RAR, ZIP
- Database: LOG, NSF, SQL
- Diagram: VDX, VSD, VSDM, VSDX
- eBook: AZW3, EPUB, MOBI
- Email & Outlook: EML, EMLX, MSG, PST
- Font: CFF, EOT, OTF, TTF
- Page Description Language: CGM, PS, SVG, XPS
- Project Management: MPP, MPT, XER
- Publisher: PUB
- Web: HTML, JSON, VDW, XML
Getting Started
Prerequisites
- Node.js (LTS recommended)
- Java Runtime Environment (JRE) 8 or later
- Windows, Linux, or macOS
Installation
Install the package from npm:
npm i @groupdocs/groupdocs.conversionFor detailed setup instructions, see the System Requirements and Installation documentation topics.
Use cases
Below are simple Node.js snippets that demonstrate typical use cases: converting a DOCX to PDF, converting PDF to PDF/A, and converting only specific pages of a document.
Convert DOCX to PDF
This code example shows how to convert a Word document (DOCX) to a PDF file with default conversion options.
'use strict';
// Require dependencies
const groupdocs = require('@groupdocs/groupdocs.conversion');
const path = require('path');
// Apply license if you have one (optional for evaluation).
const licensePath = path.resolve(__dirname, 'GroupDocs.Conversion.lic');
const license = new groupdocs.License();
license.setLicense(licensePath);
// Create a converter for the source document.
const converter = new groupdocs.Converter('source.docx');
// Set up PDF conversion options and run the conversion.
const convertOptions = new groupdocs.PdfConvertOptions();
converter.convert('converted.pdf', convertOptions);
// Exit the process
process.exit(0);Convert PDF to PDF/A
This code example shows how to convert a regular PDF document to a PDF/A-compliant PDF.
'use strict';
// Require dependencies
const groupdocs = require('@groupdocs/groupdocs.conversion');
const path = require('path');
// Apply license if you have one (optional for evaluation).
const licensePath = path.resolve(__dirname, 'GroupDocs.Conversion.lic');
const license = new groupdocs.License();
license.setLicense(licensePath);
// Create a converter for the source document.
const converter = new groupdocs.Converter('source.pdf');
// Set the format to PDF/A-compliant PDF
const pdfOptions = new groupdocs.PdfOptions();
pdfOptions.setPdfFormat(groupdocs.PdfFormats.PdfA_1A);
// Set the convert options
const convertOptions = new groupdocs.PdfConvertOptions();
convertOptions.setPdfOptions(pdfOptions);
// Convert the document
converter.convert('converted_pdfa.pdf', convertOptions);
// Exit the process
process.exit(0);Convert Specific Pages
This code example shows how to convert only selected pages of a Word document (DOCX) to a PDF document.
'use strict';
// Require dependencies
const groupdocs = require('@groupdocs/groupdocs.conversion');
const path = require('path');
// Import java array list
const java = require('java');
const ArrayList = java.import('java.util.ArrayList');
// Apply license if you have one (optional for evaluation)
const licensePath = path.resolve(__dirname, 'GroupDocs.Conversion.lic');
const license = new groupdocs.License();
license.setLicense(licensePath);
// Create a converter for the source document
const converter = new groupdocs.Converter('source.docx');
// Set pages to convert
const pages = new ArrayList();
pages.add(1);
pages.add(2);
pages.add(3);
// Set the convert options
const convertOptions = new groupdocs.PdfConvertOptions();
convertOptions.setPages(pages);
// Convert pages 1, 2, and 3 to PDF
converter.convert('converted_pages_1_2_3.pdf', convertOptions);
// Exit the process
process.exit(0);Troubleshooting
- Download during installation fails (corporate proxy/firewall): Ensure your environment allows downloading the required JAR during
postinstall. If needed, download the file manually to thelib/directory as described in the Installation Guide. - Java not found: Make sure Java (JRE 8+) is installed and available on your system
PATH. - Permission issues when writing output files: Verify your process has write access to the target directory.
Licensing
For testing without trial limitations, you can request a 30-day Temporary License:
- Visit the Get a Temporary License page
- Login with your company email address
- Request a temporary license and get it in your mailbox
After you receive the license file, save it locally and use it in your application as follows:
'use strict';
const groupdocs = require('@groupdocs/groupdocs.conversion');
// Apply license
const license = new groupdocs.License();
license.setLicense('GroupDocs.Conversion.lic');This product is licensed under the GroupDocs End User License Agreement (EULA). For pricing information, visit the GroupDocs.Conversion for Node.js via Java pricing page.
Support
GroupDocs provides unlimited free technical support for all of its products. Support is available to all users, including evaluation. The support is provided at Free Support Forum, Paid Support Helpdesk and Paid Consulting.
Free Support Forum
The GroupDocs Free Support Forum is available to all users and provides:
- Human support by the product team
- No time limitations on support requests
- Access to historical solutions and discussions
Paid Support Helpdesk
The Paid Support Helpdesk offers:
- Higher priority response times
- Dedicated support team
- Extended support hours
- Priority issue resolution
Paid Consulting
We can work together with you on your project and develop a part or complete application. If you need new features in the existing GroupDocs product or to create API for new file formats, send us a request at consulting.groupdocs.com/contact.
| Product Home | Documentation | Blog | Code Samples | Free Support | Temporary License | Pricing |
