hyzyla / pdfium

Node.js wrapper for the PDFium library
https://pdfium.js.org
MIT License
22 stars 3 forks source link

Scaling in both dimentions #8

Open michaelpastushkov opened 6 days ago

michaelpastushkov commented 6 days ago

Can you please make scaling to accept width and height number, instead of just one for both. This would be a great help for many situations. BTW muPDF does that. Great simple wrapper otherwise!! Tx.

hyzyla commented 6 days ago

@michaelpastushkov. I've just added width and height options to PDFiumPage.render function in v1.0.3 version

📝 width and height, instead of scale

michaelpastushkov commented 5 days ago

Thanks a lot! One small addition that might save a lot of debugging time for many - round to the lower integer number inside your code. Or else we have to do it in ours (sizes are often calculated and may have decimals, in which case the render fails).

    const bitmap = await pdf_page.render({
        width: Math.floor(dst_width),
        height: Math.floor(dst_height),
        render: 'bitmap'
    });