pdf-mania
v1.0.7
Published
A Package that provides conversion and merger of various types of documents to PDF document
Downloads
37
Maintainers
Readme
pdfMania
Overview
pdfMania
is a Node.js CLI tool that allows you to convert files to PDF format and merge multiple files into a single PDF. This tool is designed to be simple and efficient, making it easy to perform these operations directly from the command line. Additionally, the core functions can be used in JavaScript projects.
Installation
To install pdfMania
, you can use npm:
npm install -g pdf-mania
Usage
CLI Usage
Convert a File to PDF
To convert a file to PDF format, use the convert command followed by the input file and the desired output file.
pdfMania convert <input> <output>
Example:
pdfMania convert document.docx output.pdf
Merge Multiple Files into a Single PDF
To merge multiple files into a single PDF, use the merge command followed by the input directory containing the files and the desired output file.
pdfMania merge <input_directory> <output>
Example:
pdfMania merge ./documents merged.pdf
JavaScript API Usage
You can also use the core functions of pdfMania in your JavaScript projects. Convert a File to PDF
To convert a file to PDF format programmatically, use the convertToPdf function.
const { convertToPdf } = require('pdfMania');
convertToPdf('document.docx', 'output.pdf')
.then(() => console.log('Conversion completed'))
.catch(err => console.error('Conversion failed:', err.message));
Merge Multiple Files into a Single PDF
To merge multiple files into a single PDF programmatically, use the mergeDocumentsToPdf function.
const { mergeDocumentsToPdf } = require('pdfMania');
mergeDocumentsToPdf('./documents', 'merged.pdf')
.then(() => console.log('Merge completed'))
.catch(err => console.error('Merge failed:', err.message));