The example documentation says it "contains detailed examples of how to use pdf-lib to both create and modify documents in Node, Browser, and React Native environments."
AFAI can see, it only contains examples for Node. If not, where are they hidden? :smile_cat:
In any case, what I was wondering was how to get the bytes needed from a browser File object into pdf-lib, which I through some searching in the issues saw was already answered.
response.arrayBuffer()
.then(function(buffer) {
const existingPdfDocBytes = new Uint8Array(buffer);
const pdfDoc = PDFLib.PDFDocumentFactory.load(
existingPdfDocBytes
);
I think having a super-simple example in the example folder with an index.html, a test pdf and the above code would be sufficient for most to get working. I could supply it as a PR, unless it already exists?
Hello @fatso83! Unfortunately no such example exists in this repo at the moment. I was working on some browser and React Native examples awhile ago, but got busy with other issues. So I鈥檝e never had a chance to finish and commit them. I鈥檇 greatly appreciate PRs for this if you鈥檙e willing to help out!
Done :) #92
v1.0.0 was just released. It includes multiple browser examples (inspired by your work in #92), so I think it's reasonable to close this now.