v1 ready for publish

This commit is contained in:
2025-05-06 17:53:17 -06:00
parent 03a1e3ed21
commit 6346b28581
11 changed files with 53 additions and 28 deletions

View File

@@ -1,3 +1,5 @@
import type { ToolFunc } from "../types.ts";
type transformer = (arg: string) => any;
interface IConfig {
multiTransform?: boolean;

View File

@@ -1,4 +1,4 @@
import { PDFDocument } from "pdf-lib";
import { PDFDocument, PDFTextField } from "pdf-lib";
export async function loadPdfForm(path: string) {
const pdfDoc = await loadPdf(path);
@@ -13,6 +13,11 @@ export async function loadPdf(path: string) {
}
export async function savePdf(doc: PDFDocument, path: string) {
doc.getForm().getFields().forEach((field) => {
if (field instanceof PDFTextField) {
field.disableRichFormatting();
}
});
const pdfBytes = await doc.save();
if (Deno.env.get("DRYRUN") || path.includes("dryrun")) return;
await Deno.writeFile(path, pdfBytes);