PDF Paper Size



  • Dear all,

    I would like to create a PDF file with standard of A4 paper size. but when I create like this

    
    var report = await rs.RenderAsync(new RenderRequest()
                    {
                        Template = new Template()
                        {
                            Recipe = Recipe.ChromePdf,
                            Engine = Engine.Handlebars,
                            Chrome = {
                                      DisplayHeaderFooter = true,
    			                      Format = "A4",
    			                      MarginTop = "130px",
    			                      MarginBottom = "110px",
    			                      MarginLeft = "105px",
    			                      MarginRight = "105px"
                                     },
                            Content = @htmlcode
                        }
                    });
    

    I got a message error System.NullReferenceException: 'Object reference not set to an instance of an object.' But if I delete the Chrome option it working fine. Can someone help me?



  • Please try this

    Template = new Template()  {
      Recipe = Recipe.ChromePdf,
      Engine = Engine.Handlebars,
      Chrome = new Chrome {
        DisplayHeaderFooter = true,
        Format = "A4",
        MarginTop = "130px",
        MarginBottom = "110px",
        MarginLeft = "105px",
        MarginRight = "105px"
      }
    }
    
    


  • @jan_blaha , it's working thank you


Log in to reply
 

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