Closed moshest closed 5 months ago
I don't think we need to be holier than the pope: https://github.com/mozilla/pdf.js/blob/12875359c387d7e2d312c50748833b3c52d986aa/src/display/api.js#L234
function getDocument(src) {
// ...
if (typeof src === "string" || src instanceof URL) {
src = { url: src };
} else if (isArrayBuffer(src)) {
src = { data: src };
}
// ...
}
Problem
What problem are you trying to solve? What issue does this close?
The
pdf2md
say it will receive the following type:However, it only works with
BinaryData
type.Solution
How did you solve the problem?
I add a type check and make the first argument convert to
docOptions
depends on the type given:This should match the docs of
pdfjs
: https://mozilla.github.io/pdf.js/api/draft/module-pdfjsLib.html