javascript - pdfmake get wrong page position sizes - Stack Overflow

I am using it on the client side and my pdf file will contain only images. No matter how many i am addi

I am using it on the client side and my pdf file will contain only images. No matter how many i am adding, first image got opposite width with height. While from second and farther everything looks ok. And config that i am using is:

var content = [];
for (var j = 0; j < pages.length; j++) {
    if(pages[j].dataUrl) content.push({
        image: pages[j].dataUrl,
        width: 891,
        height: 630
    });
}
var docDefinition = {
    pageSize: {
        width: 891,
        height: 630
    },
    pageOrientation: 'landscape',
    pageMargins: [ 0, 0, 0, 0 ],
    content: content
};
pdfMake.createPdf(docDefinition).open();

I am using it on the client side and my pdf file will contain only images. No matter how many i am adding, first image got opposite width with height. While from second and farther everything looks ok. And config that i am using is:

var content = [];
for (var j = 0; j < pages.length; j++) {
    if(pages[j].dataUrl) content.push({
        image: pages[j].dataUrl,
        width: 891,
        height: 630
    });
}
var docDefinition = {
    pageSize: {
        width: 891,
        height: 630
    },
    pageOrientation: 'landscape',
    pageMargins: [ 0, 0, 0, 0 ],
    content: content
};
pdfMake.createPdf(docDefinition).open();
Share Improve this question asked Jan 5, 2017 at 20:29 Honchar DenysHonchar Denys 1,5184 gold badges29 silver badges58 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Strange, but with setup

pageSize: {
    width: 630,
    height: 891
}

It's working. This is lib bug, refer to Issues of Repo.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745380018a4625180.html

相关推荐

  • javascript - pdfmake get wrong page position sizes - Stack Overflow

    I am using it on the client side and my pdf file will contain only images. No matter how many i am addi

    5小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信