fix(readme): Update readme documentation: enhance feature summary, update installation instructions and usage examples, remove obsolete config details, and better clarify supported invoice formats.

This commit is contained in:
2025-04-03 20:45:26 +00:00
parent 72f27e69cd
commit 6b40eac61f
5 changed files with 234 additions and 198 deletions

View File

@ -1,5 +1,4 @@
import { PDFDocument, PDFDict, PDFName, PDFRawStream, PDFArray, PDFString } from 'pdf-lib';
import * as pako from 'pako';
import { PDFDocument, PDFDict, PDFName, PDFRawStream, PDFArray, PDFString, pako } from '../../../plugins.js';
/**
* Base class for PDF XML extractors with common functionality
@ -149,7 +148,7 @@ export abstract class BaseXMLExtractor {
try {
const decompressedBytes = pako.inflate(compressedBytes);
const xmlContent = new TextDecoder('utf-8').decode(decompressedBytes);
if (this.isValidXml(xmlContent)) {
console.log(`Successfully extracted decompressed XML from PDF file. File name: ${fileName}`);
return xmlContent;
@ -158,16 +157,16 @@ export abstract class BaseXMLExtractor {
// Decompression failed, try without decompression
console.log(`Decompression failed for ${fileName}, trying without decompression...`);
}
// Try without decompression
const rawBytes = stream.getContents();
const rawContent = new TextDecoder('utf-8').decode(rawBytes);
if (this.isValidXml(rawContent)) {
console.log(`Successfully extracted uncompressed XML from PDF file. File name: ${fileName}`);
return rawContent;
}
return null;
} catch (error) {
console.error('Error extracting XML from stream:', error);