-->

How to set the width of the page?

2019-07-25 09:29发布

问题:

I have been trying to increase the width of pdf but nothing seems to work:

<style type="text/css">
@page {
    size: a4 landscape;
    width: 27cm;  /* not working */
    @frame content {
        top: 2cm;
        width: 27cm;  /* not working */
        margin-left: 1.5cm;  /* changing these values work!! */
        margin-bottom: 2cm;  /* changing these values work!! */
    }
}
</style>

No matter what I try, the content width doesn't seem to increase. All my <div>, <tables> are at 100%, and reducing the margin increases the size of the table, so the 100% is probably working. But how to increase the width of the main container? From what I can deduce, it looks like it is keeping to some default width, and it does not increase, because both portrait and landscape result in the same width content.

Anyone got any ideas?