Base64 PDF Uploads to S3

Has anyone uploaded PDFs from base64 format to S3 through a Meteor method?

I’ve gotten as far as sending the file to the S3 bucket but when I open it it’s all garbled text because the embedded font failed to extract for some reason. On the client side the PDF can be generated and downloaded with no problem.

I really don’t have any idea what the best practices are for PDFs.

I did a little bit of this earlier this year, although I can’t really speak to embedded fonts, as we were using webshot to generate the pdfs on the server. A cool package to check out though is base64-string-s3, which makes streaming pdfs to an s3 bucket pretty easy.

1 Like

Some relevant code if you decide to use that package:

var base64data = new Buffer(pdfData).toString('base64');

1 Like