mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
initial implementation of note attachments
This commit is contained in:
@@ -31,6 +31,22 @@ function updateFile(req) {
|
||||
|
||||
note.setLabel('originalFileName', file.originalname);
|
||||
|
||||
if (note.mime === 'application/pdf') {
|
||||
const pdfjsLib = require("pdfjs-dist");
|
||||
|
||||
(async () =>
|
||||
{
|
||||
let doc = await pdfjsLib.getDocument({data: file.buffer}).promise;
|
||||
let page1 = await doc.getPage(1);
|
||||
let content = await page1.getTextContent();
|
||||
let strings = content.items.map(function (item) {
|
||||
return item.str;
|
||||
});
|
||||
|
||||
console.log(strings);
|
||||
})();
|
||||
}
|
||||
|
||||
return {
|
||||
uploaded: true
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user