Hopding/pdf-lib — reverse-engineered prompt
Reverse engineered prompt
Build me a JavaScript and TypeScript library for working with PDF files in any modern runtime, including Node, the browser, Deno, and React Native.
I want people to be able to create a PDF from scratch, load an existing PDF, edit it, add or remove pages, copy pages between PDFs, draw text, images, vector shapes, and SVG paths, embed custom fonts, and measure text size. It should also support PDF forms, including creating fields, filling them out, and flattening them so they can’t be edited later.
Please include support for document metadata, viewer preferences, attachments, and saving the final PDF as bytes so it can be downloaded in a browser or written to a file. Make the API feel simple and friendly, with clear examples for common tasks like making a document, modifying one, filling a form, and combining pages from multiple PDFs.
Add tests and basic docs so someone can actually use it. Look up current docs online if you need to.
Want more depth? Deep Reverse