I haven’t used PDFKit, but I’ve used pdfmake & pdf-lib on Velo to create PDFs, which similarly use ArrayBuffers to store the PDF data. Of the two, PDF-lib was the easier to use of the two for me, and they of course are both open-sourced.
Unfortunately I can’t share the code, but I was able to pretty much adapt the examples from the pdf-lib examples for Velo , so I can guide you from there if that works.