Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@accusoft/document-processing-helper

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@accusoft/document-processing-helper

Simple node.js API for document processing, powered by PrizmDoc Server.

  • 1.0.0-beta.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
48
increased by37.14%
Maintainers
1
Weekly downloads
 
Created
Source

document-processing-helper (BETA)

Simple node.js helper for document processing, powered by PrizmDoc Server. You can use this helper with either PrizmDoc Cloud or your own self-hosted PrizmDoc Server.

If you don't have your own PrizmDoc Server instance, the easiest way to get started is with PrizmDoc Cloud. Sign up for a free trial account to get an API key at https://cloud.accusoft.com/.

Requires node 8 or higher.

Installation

npm install @accusoft/document-processing-helper

Example Usage

Converting a JPEG to PDF

const Helper = require('@accusoft/document-processing-helper');

async function main() {
  const documentProcessingHelper = new Helper({
    prizmDocServerBaseUrl: 'https://api.accusoft.com',
    apiKey: 'YOUR_API_KEY'
  });

  // Initialize a conversion
  const output = await documentProcessingHelper.convert({
      input: 'input.jpeg',
      outputFormat: 'pdf'
    });

  // Download the output and save the file
    await output[0].saveToFile('output.pdf');
}

main();

Converting a multipage PDF to PNG files (one PNG per page)

const Helper = require('@accusoft/document-processing-helper');

async function main() {
  const documentProcessingHelper = new Helper({
    prizmDocServerBaseUrl: 'https://api.accusoft.com',
    apiKey: 'YOUR_API_KEY'
  });

  // Initialize a conversion
  const output = await documentProcessingHelper.convert({
      input: 'input.pdf',
      outputFormat: 'png'
    });

  // Save each ouput PNG file
  for (let i = 0; i < output.length; i++) {
    await output[i].saveToFile('page-' + i + '.png');
  }
}

main();

API Reference

Class: Helper

Constructor
  • argumentsObject (object)
    • prizmDocServerBaseUrl (string) Required. Location of your PrizmDoc Server.
    • apiKey (string) Required for PrizmDoc Cloud. Your PrizmDoc Cloud API key.
convert(argumentsObject)

Converts a document from one file type to another.

  • argumentsObject (object)

    • input (string, buffer, stream) Required. File path, buffer, or stream of the input file to convert
    • outputFormat (string) Required. Output format. Must be one of the following values:
      • "pdf"
      • "docx" - Input must be a PDF.
      • "tiff"
      • "jpeg" - Produces multiple output files, one per page.
      • "png" - Produces multiple output files, one per page.
  • Returns: Output[] - Array of Output instances.

Class: Output

saveToFile(filepath)

Saves the result of a conversion to a file.

  • filepath (string) Required. Path, including filename, where the output should be saved.

Keywords

FAQs

Package last updated on 02 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc