wkhtmltopdf - 禁用分页功能

Van*_*ing 8 wkhtmltopdf

我正在尝试将谷歌地图嵌入到横向PDF中,但不知何故,wkhtmltopdf总是将地图分为两部分,尽管地图很容易放在一页上.

我认为问题是,地图是用瓷砖建造的.瓷砖比地图大并且被切断,但是wkhtmltopdf似乎忽略了这一点并且认为切割的瓷砖也必须适合页面...

以下是一些重现此示例的示例代码:

<html>
    <head>
        <script src="https://maps.google.com/maps/api/js?sensor=false"></script>
        <script>
            window.onload = function(){                     
                var fenway = new google.maps.LatLng(47.188563,8.480487);
                var gmap = new google.maps.Map(document.getElementById("map"),{
                    center: fenway,
                    zoom: 14,
                    mapTypeId: google.maps.MapTypeId.ROADMAP,
                    disableDefaultUI: true
                });

                var marker = new google.maps.Marker({
                    position: fenway,
                    map:gmap
                });         

                google.maps.event.addListener(gmap,"tilesloaded",function(){
                    window.status = "ready";
                });
            }
        </script>
    </head>
    <body>
        <div id="map" style="width:1500px;height:800px"></div>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

以及将其转换为PDF的命令:

wkhtmltopdf --window-status ready --orientation landscape map.html map.pdf

我顺便使用最新版本的wkhtmltopdf ......

是否有可能使地图填满没有剪切的页面?

Ali*_*ogy 1

它并不是真正禁用分页符,但设置主体高度确实会在一页上渲染您的地图。

<body style="height:1000px;">
    <div id="map" style="width:1500px;height:800px;"></div>
</body>
Run Code Online (Sandbox Code Playgroud)