Pdfmake: Scale images to fit?

Created on 11 Mar 2018  路  3Comments  路  Source: bpampuch/pdfmake

I have large images that I am adding to my pdf, but they are cropped so I only see the top left corner of the image on the page. Images are 2052x2737. How can I make the images fit the pages so that 100% of the image is displayed (no borders)? I have the page size set to LETTER.

Most helpful comment

Like this:

var dd = {
    pageSize: 'LETTER', //pageSize: { width: 612.00, height: 792.00},
    pageMargins: [0, 0, 0, 0],
    content: [
        {
            image: 'sampleImage.jpg',
            width: 612.00,
            height: 792.00
        }
    ]
}

All 3 comments

Like this:

var dd = {
    pageSize: 'LETTER', //pageSize: { width: 612.00, height: 792.00},
    pageMargins: [0, 0, 0, 0],
    content: [
        {
            image: 'sampleImage.jpg',
            width: 612.00,
            height: 792.00
        }
    ]
}

Is LETTER == 612 x 792? That is really low resolution. Is there a way to create a PDF with a physical size of 8.5" x 11" or 9" x 12" and have the images stored with a higher resolution/DPI?

Page 612 x 792 is not a resolution but it is page size in points.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stefanmihoc picture stefanmihoc  路  3Comments

einfallstoll picture einfallstoll  路  3Comments

Masber picture Masber  路  3Comments

jkd003 picture jkd003  路  3Comments

michaelqiji picture michaelqiji  路  3Comments