代码之家  ›  专栏  ›  技术社区  ›  Elton Santos

传单浏览器打印插件打印时不显示比例

  •  0
  • Elton Santos  · 技术社区  · 7 年前

    我正在使用插件传单浏览器打印,有一个问题,当我单击打印时,我想在打印中显示比例,但我根本做不到。即使您完全按照示例中所示进行了配置( https://github.com/Igor-Vladyka/leaflet.browser.print ),它不会出现。

    我的代码是基本的:

    // PRINT
            ctlPrint = L.browserPrint({
                closePopupsOnPrint: false,      
                printModesNames: {Portrait:"Retrato", Landscape:"Paisagem", Auto:"Auto", Custom:"Selecione a área"}
            }).addTo(map);
    
            map.on("browser-print-start", function(e){
                L.control.scale({
                    position: 'topleft',
                    imperial: false,
                    maxWidth: 200
                }).addTo(e.printMap);
            });
    

    就这样!根据代码,比例应该显示在顶部和左侧,在打印前的预览中,它实际上显示了比例,但何时打印数字。有人帮我吗?谢谢我的代码在这里: https://github.com/eltonsantos/mapasFortaleza/blob/master/js/script.js

    1 回复  |  直到 7 年前
        1
  •  1
  •   Javier Rufas    7 年前

    尝试“浏览器预打印”事件。

    当触发“浏览器打印开始”事件时,仍会创建覆盖。

    查看中的打印功能

    https://github.com/Igor-Vladyka/leaflet.browser.print/blob/master/src/leaflet.browser.print.js