npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pdfix-sdk

v8.4.0

Published

Take the full control over the PDF documents with PDFix SDK. Leverage the advantages of the PDFix SDK WebAssembly build for use in both Node.js and web applications

Downloads

305

Readme

PDFix SDK Package

PDFix SDK - High Performace PDF library

keywords: pdf, accessibility, remediation, extraction, html, conversion, render, watermark, redact, sign, forms

PDFix SDK analyses the key components of the PDF and makes it easily available for you to manipulate. It’s a high-performance library that helps software developers and end-users integrate PDF functionality into their workflows.

Features

  • Automated PDF Remediation (PDF/UA)
  • Automated Data Extraction (JSON, XML)
  • PDF to HTML Conversion (Original, Responsive, by Tags)
  • Standard PDF Editing Features (render, watermark, redact, sign, forms, and more)

Change log

https://github.com/pdfix/pdfix_sdk_builds/blob/main/changelog.md

Supported platforms

  • Linux amd64
  • Windows amd64
  • macOS amd64, arm64

Taking Advantages of WebAssembly

Leverage the advantages of the PDFix SDK WebAssembly build for use in both Node.js and web applications. This allows to execute code at near-native speeds. Reduce the need for server-side processing and improve your web app responsiveness.

Getting Started

Using this package, you can get started either in Node.js or in browser - web environment.

To install the package, run this command:

npm i pdfix-sdk

For use in Node.js

const Pdfix = require('pdfix-sdk');

const pdfixSdkWrapper = new Pdfix();
pdfixSdkWrapper.loadPdfixSdk().then(() => {
  const pdfixSdk = pdfixSdkWrapper.getPdfixSdk();
  const pdfix = pdfixSdk.GetPdfix();
  const pdfDoc = pdfixSdkWrapper.openDocumentFromPath("<YOUR_DOCUMENT_PATH>");

  // your code ...

  pdfDoc.Close();
  pdfix.Destroy();
});

For use in Web (browser)

Run this command in the location of installed NPM package to get the package for web:

npm run get-web-package --path=<OPTIONAL_PATH>

  • If the --path option is set, it will put the files for web there.
  • You will find those files in ./dist folder instead.

Use the PDFix SDK accordingly:

// replace with your import path
import { Pdfix as PdfixSdkWrapper, PdfixSdk } from './assets/pdfix/index';
import { Pdfix, PdfDoc } from 'PDFIX_WASM';

const pdfixSdkWrapper: PdfixSdkWrapper = new PdfixSdkWrapper();
// provide your "helper" path ('/assets/pdfix/') if your
// web app cannot find wasm binary
pdfixSdkWrapper.loadPdfixSdk('/assets/pdfix/').then(() => {
  const pdfixSdk: PdfixSdk = pdfixSdkWrapper.getPdfixSdk();
  const pdfix: Pdfix = pdfixSdk.GetPdfix();
  const pdfDoc: Promise<PdfDoc> = pdfixSdkWrapper.openDocumentFromUrl('<YOUR_DOCUMENT_URL>');

  // your code ...

  pdfix.Destroy();
});

TypeScript Declaration File & Documentation

The package comes with a TypeScript Declaration File (d.ts) for the pdfix_wasm module. Thus it is recommended to get started with a TypeScript based project. To get more details about any of the functions in the SDK, check in our Documentation

Powerful Solutions

We want to show the world that it is possible to take advantage of all the amazing features that PDF has available without the headache of having to understand them yourself.

Make PDF Accessible

Make your PDFs PDF/UA compliant in ease.

const pdfDoc: PdfDoc = pdfix.openDocumentFromPath('<YOUR_DOCUMENT_PATH>');
const pdfAccessibleParams: PdfAccessibleParams = new pdfixSdk.PdfAccessibleParams();
pdfDoc.MakeAccessible(
  pdfAccessibleParams,
  "Document Title",
  "en-US",
  0,
  0
);
pdfDoc.Close();

Add Tags to PDF

Improve Accessibility in Existing PDF Files.

const pdfDoc: PdfDoc = pdfix.openDocumentFromPath('<YOUR_DOCUMENT_PATH>');
const pdfTagsParams: PdfTagsParams = new pdfixSdk.PdfTagsParams();
pdfDoc.AddTags(pdfTagsParams, 0, 0);
pdfDoc.Close();

PDF to HTML, PDF to Responsive HTML

Easily convert any PDF into HTML.

function streamToString(sdk: PdfixSdk, stream: PsStream): string {
  const ptr: number = sdk._malloc(stream.GetSize());
  stream.Read(0, ptr as any, stream.GetSize());
  let string: string = '';
  for (let i = 0; i < stream.GetSize(); i++) {
    string += String.fromCharCode((sdk as any).HEAP8[ptr + i])
  }
  return string;
}

const pdfDoc: PdfDoc = pdfix.openDocumentFromPath('<YOUR_DOCUMENT_PATH>');
const pdfToHtmlConversion: PdfHtmlConversion = pdfDoc.CreateHtmlConversion();
let pdfHtmlParams: PdfHtmlParams = new pdfixSdk.PdfHtmlParams();
pdfHtmlParams.flags |= (
  PdfixEnum.kHtmlNoExternalCSS |
  PdfixEnum.kHtmlNoExternalJS |
  PdfixEnum.kHtmlNoExternalIMG |
  PdfixEnum.kHtmlNoExternalFONT
);
pdfHtmlParams.type = PdfHtmlType.kPdfHtmlResponsive;
pdfToHtmlConversion.SetParams(pdfHtmlParams);
pdfToHtmlConversion.AddPage(1, 0, 0);
const stream: PsStream = pdfixSdk.GetPdfix().CreateMemStream();
pdfToHtmlConversion.SaveToStream(stream, 0, 0);
const htmlString = streamToString(pdfixSdk, stream);
stream.Destroy();
pdfToHtmlConversion.Destroy();

console.log(htmlString);
pdfDoc.Close();

Have a question? Need help?

Let us know and we’ll get back to you. Write us to [email protected] or fill the contact form.