I am using node version 7.10.0 with:
pdf2json version 1.1.7 mail parser version 2.0.5 smtp-server version 3.0.1
I have received an email with a PDF attachment and I want to parse the PDF using pdf2json without saving the PDF to disk, I have the byte array from the email attachment. How can I parse this directly to the module?
I thought I could do this:
const pdfParser = require("pdf2json");
let objPDF = new pdfParser();
objPDF.parseBuffer(arybytContent);
Where 'arybytContent' is the content from the mail attachment:
arybytContent = objAttachment["content"]["data"];
Looking at objPDF using Chrome, it doesn't look like the content has been parsed correctly, have a used the class incorrectly?
via SPlatten
No comments:
Post a Comment