v1 ready for publish
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { ToolFunc } from "../types.ts";
|
||||
|
||||
type transformer = (arg: string) => any;
|
||||
interface IConfig {
|
||||
multiTransform?: boolean;
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user