You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
spasca-fot-sloan-q1/backend/converters/html_from_pdf_with_image_ur...

13 lines
463 B

const fs = require('fs');
function convert( filename, pages ){
console.log(pages)
if (filename.endsWith('.pdf')) {
let data = pages.map( p => "<img src='/"+filename+'-'+p+".jpg'/>").join('<br>')
// could have a richer datastructure with e.g. p.number for the page number and p.x and p.y for CSS absolute positioning
const outputFile = './public/saved/html/'+filename+'.html'
fs.writeFileSync(outputFile, data);
}
}
module.exports.convert = convert