1.0.1 • Published 7 months ago

convert-doc-to-pdf v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

convert-doc-to-pdf

Description

convert-doc-to-pdf is a Node.js-based application that recursively converts all .doc and .docx files in a specified folder and its subdirectories to PDF. The application ensures all Microsoft Word instances are terminated before the conversion process starts, and provides detailed logging throughout the process. This package tested only on Windows OS, not yet tested on Linux or MacOS

Features

  1. Recursively converts .doc and .docx files to PDF

  2. Handles subdirectories

  3. Terminates all running Microsoft Word instances before starting the conversion

  4. Provides detailed logging with timestamps and process times

  5. Skips temporary Word files to avoid errors

Requirements

  1. Node.js(v14 or higher)

  2. npm (Node Package Manager)

  3. Microsoft Word (for the VBScript to interact with)

  4. Windows OS (Not tested on Linux or MacOS)

Installation

Globally:

  • Install globally if you plan to use it directly from Command line:
npm install -g convert-doc-to-pdf

Locally:

  • Install locally to a project to use it within your project:
npm install convert-doc-to-pdf

Executable

  • Download convert-doc-to-pdf.exe and assets folder or clone the project and run from its root directory
convert-doc-to-pdf --input "path/to/input/folder" --output "path/to/output/folder" --log-level debug

Usage

Usage from command-line:

  • From command line run:
node build/index.js --input "path/to/input/folder" --output "path/to/output/folder" --log-level debug

import convert2PDF from 'convert-doc-to-pdf';

async () => {
	const result = await convert2PDF(
		false,
		true,
		'path-to-input-folder',
		'path-to-output-folder',
		'<log-level> (default "info")',
		'path-to-log-file(default"Output folder")'
	);
};

Command-line options:

  • --input, -i: Input directory path (required)

  • --output, -o: Output directory path (default: ./exported)

  • --log-level, -ll: Log level (info, debug, warn; default: info)

  • --log-file, -lf: Log file path (default: ./convert-.log)

Example

node build/index.js --input "C:\path\to\input\folder" --output "C:\path\to\output\folder" --log-level debug --log-file "./logs/convert.log"

Project Structure

convert-doc-to-pdf/ ├── build/ │ ├── index.js │ ├── convertDocToPdf.js ├── src/ │ ├── script.vbs ├── package.json ├── README.md ├── tsconfig.json

Logging

The application provides detailed logs with timestamps and process times. Logs can be saved to a file or printed to the console.

Contributing

Contributions are welcome! Please submit a pull request or open an issue for any suggestions or improvements.

License

This project is licensed under the ISC License.

Author

Mustafa Heidar

Repository

You can find the GitHub repository for this project at: convert-doc-to-pdf

1.0.1

7 months ago

1.0.0

7 months ago