PDF document formatting is out of aligned



  • I'm using Phantom-pdf recipe to generate PDF document I can generate document successfully on my DEV machine but when I generate the same document from Integration environment. The formatting out of aligned. All the Images and font size seems to be little big.

    The total number of pages in my DEV environment is 32 but when I print the same document it got 50.

    No so sure where exactly the issue is.

    return jsreport.render({
                template: {
                    content: html,
                    engine: 'jsrender',
                    phantom: {
                        footer: "<table width='100%'><tr><td width='33.33%'>{{:number}}</td><td width='33.33%' align='center'>Page {#pageNum} of {#numPages}</td><td width='33.33%' align='right'>{{:Date}}</td></tr></table>",
                        format: "A4",
                        orientation: 'portrait',
                        waitForJS: true
                    },
                    recipe: 'phantom-pdf'
                },
                data: {              
                }
            }).then(function (resp) {
                callback(/* error */ null, resp.content.toJSON().data);
    

    HTML content:

        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Some title</title>
        <link rel="stylesheet" href="@this.Context.Request.Scheme://@this.Context.Request.Host@this.Context.Request.PathBase/assets/bootstrap-3.3.7.min.css" />   
        <script>
            //Start printing document only when all the images are downloaded & loaded on the document
            window.onload = function () {
                window.JSREPORT_READY_TO_START = true;
            };
        </script>
    </head>
    <body>
        <div> 
            <br />
            <div class="row">
                <div class="col-12 text-center">                
                </div>
            </div>               
            @RenderBody()        
        </div>   
    </body>
    

    Im using bootstrap to do some formatting. Any idea why document formatting looks different from environment to the environment with the same HTML content.

    Esp I see all the images gone double the size.



  • This is known phantomjs issue. See here the problem description and workaround.
    https://jsreport.net/learn/phantom-pdf#different-sizes-on-windows-vs-unix


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.