leaflet-easyPrint icon indicating copy to clipboard operation
leaflet-easyPrint copied to clipboard

is that possible to print current map in 300 dpi.?

Open mackspidy opened this issue 7 years ago • 6 comments

Hi,

I have to print my current map into 300 dpi so I can pint with big size or resolution in the same state.?

mackspidy avatar Sep 24 '18 17:09 mackspidy

Did you figure this out? @mackspidy

impactcolor avatar Nov 20 '18 06:11 impactcolor

Hello,

yes its possible to print in this with 300 DPI

On Tue, Nov 20, 2018 at 12:17 PM Omar Guzman [email protected] wrote:

Did you figure this out? @mackspidy https://github.com/mackspidy

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rowanwins/leaflet-easyPrint/issues/86#issuecomment-440162918, or mute the thread https://github.com/notifications/unsubscribe-auth/ApfyvoN3SiUBPGUMG0PnTXT10GS_icTBks5uw6VngaJpZM4W3HIu .

--

mackspidy avatar Nov 20 '18 06:11 mackspidy

actually we have to resize it.

mackspidy avatar Nov 20 '18 07:11 mackspidy

@mackspidy can you be more precise please ? Where to resize it ?

micabrunel avatar Aug 22 '19 10:08 micabrunel

Any progress on this?

Tomas2D avatar Jun 17 '21 22:06 Tomas2D

Here is an ugly work around that I use for a programmatically screenshot trigger.

  1. It oversize the map.
  2. Place a leaflet layer in the middle of the map.
  3. Take the screenshot.
  4. Reset the old map size.

const width_target = 1920, height_target = 1920;

const printPlugin = L.easyPrint({
    exportOnly : true,
    hidden : true,
}).addTo(map);

$('#btn_export').click(function (){
    let printed = false;

    const $divMap = $('#divMap');
    const old_width = $divMap.width(), old_height = $divMap.height();

    $divMap.animate({'width' : width_target, 'height' : height_target},() => {
        map.invalidateSize();
        
        map.fitBounds(myLeafletLayerToFocus);

        map.on('moveend', ()=>{
            if (printed) return false;

            map.on('easyPrint-start', ()=>{
                printed = true;
            });

            map.on('easyPrint-finished', ()=>{
                $divMap.width(old_width);
                $divMap.height(old_height);
                
                map.fitBounds(myLeafletLayerToFocus);
                map.invalidateSize();
            });

            // *******************************************************
            printPlugin.printMap('CurrentSize', 'fileName');
            // *******************************************************
        });
    });
});

cavasinf avatar Jul 08 '21 08:07 cavasinf