HTML Print Format - A5 Page Size

Hi There,

I know there are plenty of discussion on this already.
I am trying to setup my A5 page print format on ERPNext using the below code. The print format is unsuccessful. When I am generating PDF it always default to A4 page size.

Can you please let me know what I am doing wrong? Is there is anything I need to other than this?

 .print-format table, .print-format tr, 
.print-format td, .print-format div, .print-format p {
    font-family: Monospace;
    line-height: 100%;
    vertical-align: middle;
}
@media screen {
    .print-format {
        width: 5.8in;
        padding: 0.25in;
        min-height: 8.3<style>
.print-format table, .print-format tr, 
.print-format td, .print-format div, .print-format p {
    font-family: Monospace;
    line-height: 100%;
    vertical-align: middle;
}
@media screen {
    .print-format {
        width: 5.8in;
        padding: 0.25in;
        min-height: 8.3in;
    }
}
2 Likes

hi, sir!
How did you solve this problem?

There can be two workarounds.

  1. set PDF Page Size as required from the Print Settings doc. This will be applicable for all print formats.

  2. You can also pass any options through meta tags in your HTML: Refer to Link

<html>
      <head>
        <meta name="pdfkit-page-size" content="Legal"/>
        <meta name="pdfkit-orientation" content="Landscape"/>
      </head>
Hello World!
</html>

N.B: Option One works fine. But did not succeed with Option Two. Only the orientation works in Option Two. frappe overwrites this meta data with the Print Settings attributes called pdf_page_size