Remove default margin from pdf using print format

  • How can we remove default margin from pdf letterhead.margin-left,right and top remove?

Hello, @Darshit_Patel

To apply CSS as desired, you need to create a custom print format.

@media print {
  body, html {
    margin: 0;
    padding: 0;
  }
}

I’ll tried.But it is not work using default pdf generation button.
Screenshot from 2024-03-12 11-43-54

Hello, @Darshit_Patel

If the “Print with letterhead” option is selected in your print settings, it will include the letterhead, which cannot be modified because it is applied from the core system. To customize your letterhead, you should disable the “Print with letterhead” option and design your letterhead separately.

letterhead is alreay sepreted but when we generate default pdf then auto set margin from

frappe/frappe/utils/pdf.py

How can we remove this default margin?

Hi @Darshit_Patel,

Please apply it.

body {
    margin:0 !important;
    padding:0 !important;
}

Before:

After:

I hope this helps.

Thank You!

Hii @NCP

  • on image letterhead not work.

  • Work only html

Thanks!

because of some limitations.

Yes, only have an option.

Thank You!