Change the size of pro report pages

I am trying to create a php report template, but there is one problem, can you change the size of each page? As I need the height to be smaller.

Hi @Kai,

in order to change default PDF settings, you can use the following filters:

mainwp_pro_reports_pdf_paper_format – by default it’s set to A4, but you can change it to letter, legal, etc…
mainwp_pro_reports_pdf_paper_orientation – by default it’s set to portrait but you can change to landscape

Let me know how it goes with these settings.

Hi @bogdan,

Thank you for replying so quickly.

Could you give me an example snippet on how to change them?

Thank you :slight_smile:

Hi Kai,

for example if you want to change the paper size, you can try with something like:

function my_custom_paper_size() {
    return 'letter';
add_filter( 'mainwp_pro_reports_pdf_paper_format', 'my_custom_paper_size' );

or if you want to change orientation,

function my_custom_paper_orientation() {
    return 'landscape';
add_filter( 'mainwp_pro_reports_pdf_paper_orientation', 'my_custom_paper_orientation' );

Hi @bogdan,

There seems to be a problem, when I add this to my php file, it doesn’t change anything.
I copied and pasted exactly what you have typed just to test it and it still comes out portrait and a4.

Any idea what is happening?

Can you try to install the MainWP Custom Dashboard extension, and add code snippets directly to the PHP section of the extension?

That way we will be sure that snippets are loading properly.

If that doesn’t help, I will recheck with our dev team if snippets need to be tweaked differently.

1 Like

Hi @bogdan,

That has fixed my issue, thank you. Adding it to the report template doesn’t seem to work but adding it to the custom dashboard php section worked perfectly.

Thank you :slight_smile:

1 Like

thanks for letting us know

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.