Print in A3 and A4 format

2

I need to develop something that can print in A3 and A4 formats, exactly the same as that site:

link

Note that by clicking on the print icon it first resizes to the correct format and then when you click Print, it shows the preview exactly how it wants to print, with the map only, centralized and in the required format.

Being honest, I have no basis on how to do this, because I never did. I'm using Javascript with Leaflet, how should I proceed? I still have no backend language, but are still deciding between developing using Java or Python, unfortunately that decision is not mine. I would like you to give me only one north of what to do and how to do and if possible any examples, some plugin or framework that I can use it for such.

Thank you !!

    
asked by anonymous 22.11.2017 / 00:40

1 answer

4

You can use the @media print CSS rule and start by hiding the menus and other things you do not want to print

@media print {    
.no-print, .no-print * {
    display: none !important;
  }
}

Then when you open the print screen in javascript

window.print();

Anything that has the no-print class will not be shown on the browser print screen, you can also customize the size of what you want to print within the @media print {} CSS, in the default print screen you can change the layout and paper size, so you can go by testing and adjusting what you want to show. Hope to have helped

    
22.11.2017 / 14:36