0.2.2 • Published 5 months ago
@kazuhi-ra/is-openable-pdf v0.2.2
Motivation
@kazuhi-ra/is-openable-pdf is a utility library that determines whether a PDF file can be opened in a standard PDF viewer. It returns true if the file is not password-protected or if the user password is set to the default (an empty string).
In browser environments, JavaScript alone cannot detect password protection on PDF files—particularly when the user password is an empty string. This library leverages WebAssembly to bypass that limitation and perform accurate checks on PDF accessibility.
Install
npm install @kazuhi-ra/is-openable-pdfQuick Start
import { isOpenablePdf } from '@kazuhi-ra/is-openable-pdf';
// Check a File object
const isOpenable = await isOpenablePdf(file);API
isOpenablePdf(file: File | Uint8Array): Promise<boolean>License
MIT