Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Jan Blaha
    @pofider
    at this moment it should probably work fine for you
    hepple
    @hepple
    Hi, trying to use the docx engine in dotnet core and dynamically passing in an asset but I'm getting an error. Any Ideas?
                string strDocx = _env.WebRootPath + "\\reports\\CV.docx";
                FileInfo fileInfoMain = new FileInfo(strDocx);
                if (fileInfoMain.Exists)
                {
                    FileStream fileStream = fileInfoMain.Open(FileMode.Open, FileAccess.Read);
                    using StreamReader reader = new StreamReader(fileStream);
                    strDocx = await reader.ReadToEndAsync().ConfigureAwait(true);
                    await fileStream.DisposeAsync().ConfigureAwait(true);
                }
                strDocx = strDocx.Replace(Environment.NewLine, string.Empty, StringComparison.InvariantCulture);
    
                Asset myAsset = new jsreport.Types.Asset();
                myAsset.Content = strDocx;
    
                jsreport.Types.Report report = await _jsReportMvcService.RenderAsync(new RenderRequest()
                    {
                        Template = new Template
                        {
    
                            Engine = Engine.Handlebars,
                            Recipe = Recipe.Docx,
                            Docx = new Docx {
                                TemplateAsset = myAsset
                            }
    
                        },
                        Data = null
                    })
                    .ConfigureAwait(true);
    hepple
    @hepple
    Updated the code a bit but still getting an error
    string strDocx = _env.WebRootPath + "\\reports\\CV.docx";
                FileInfo fileInfoMain = new FileInfo(strDocx);
                if (fileInfoMain.Exists)
                {
                    FileStream fileStream = fileInfoMain.Open(FileMode.Open, FileAccess.Read);
                    using StreamReader reader = new StreamReader(fileStream);
                    strDocx = await reader.ReadToEndAsync().ConfigureAwait(true);
                    await fileStream.DisposeAsync().ConfigureAwait(true);
                }
    
                byte[] plainTextBytes = System.Text.Encoding.UTF8.GetBytes(strDocx);
                string strDocTemplate = Convert.ToBase64String(plainTextBytes);
    
    
                jsreport.Types.Report report = await _jsReportMvcService.RenderAsync(new RenderRequest()
                    {
                        Template = new Template
                        {
    
                            Engine = Engine.Handlebars,
                            Recipe = Recipe.Docx,
                            Docx = new Docx
                            {
                                TemplateAsset = new Asset
                                {
                                    Encoding = "base64",
                                    Content = strDocTemplate
                                }
                            }
    
                        },
                        Data = new
                        {
                            message = "Hello world"
                        }
                    })
                    .ConfigureAwait(true);
    Error is JsReportException: Unable to render template. Error while executing docx recipe. invalid comment length. expected: 2. found: 0
    hepple
    @hepple
    Cleadon
    @hep99_twitter
    Hi - are there any docs on how to create address labels in the word template?
    Nicholas D'Autremont
    @Groumph
    Hi, I am having issues with font sizes in jsreport dotnet. Is here a way to pass args down to chrome?
    puppeteer/puppeteer#2410 this has a potential fix I want to try.
    Jan Blaha
    @pofider
    Hi, try to set this environment variable
    chrome_launchOptions_args=--font-render-hinting=none
    before initializing jsreport
    Nicholas D'Autremont
    @Groumph
    Trying it out
    Nicholas D'Autremont
    @Groumph
    Added Environment.SetEnvironmentVariable("chrome_launchOptions_args", "--font-render-hinting=none");
    at the beginning of startup.cs before setting up jsreports. Did not change the fonts.
    Jan Blaha
    @pofider
    are you sure there wasn't jsreport already running? Do you use the "KillRunningProcesses()"?
    Nicholas D'Autremont
    @Groumph
    ILocalWebServerReportingService rs = new LocalReporting()
    .UseBinary(RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
    ? jsreport.Binary.Linux.JsReportBinary.GetBinary()
    : JsReportBinary.GetBinary())
    .KillRunningJsReportProcesses()
    .Configure(cfg => cfg
    .AllowedLocalFilesAccess()
    .FileSystemStore()
    .BaseUrlAsWorkingDirectory())
    .AsWebServer()
    .Create();
            rs.StartAsync().Wait();
    
            services.AddJsReport(rs);
    currently on windows
    Jan Blaha
    @pofider
    ok, that should be ok
    Nicholas D'Autremont
    @Groumph
    Unless you can think of why font sizes are smaller than css/inline is set to. we are setting them as 9px but get 6.5.
    Jan Blaha
    @pofider
    could you put that minimal html/css to the playground and show the problem ?
    Nicholas D'Autremont
    @Groumph

    https://playground.jsreport.net/w/anon/Ud~X3Adi

    the 9px font is 6.5 and the 10px font is 7.5

    Jan Blaha
    @pofider
    how do you actually messure that font is 6.5?
    I am checking the pdf source, and there is the 9
    /F4 9 Tf
    1 0 0 -1 11 18 Tm
    <0037004b004c005600030056004b00520058004f00470003004500480003004900520051005700100056004c005d00480003001c> Tj
    ET
    this is basically saying use the 9px size for some code
    Nicholas D'Autremont
    @Groumph
    I am checking in ms word and our client is use adobe pro and seeing the same thing.
    We have a footer template, it shows as correct 9px in ms word and adobe pro.
    use = using
    Jan Blaha
    @pofider
    I think there is some kind of default 76dpi, so to get the px same in word, you can set to the chrome scale 1.34
    image.png
    but dont know the theory much, and need to go offline for today, good luck...
    Nicholas D'Autremont
    @Groumph
    Thank you for the help! I will try that.
    Nicholas D'Autremont
    @Groumph
    @pofider, the scaling fixed it perfectly. Thank you.
    Fred
    @wastaz
    Im having a bit of an issue where many things call jsreport in parallell which in turn ends up with most requests getting a timeout error because pdf generation takes...well..time. Would switching to async help or not in this case?
    BJR Matos
    @bjrmatos
    hi @wastaz, it depends on the setup you have, your server resources, and how complex are the templates you are executing. does the requests you have are trying to render different templates or all request are just doing multiple executions of one template?
    Fred
    @wastaz
    @bjrmatos They are basically all doing multiple executions of the same template.
    Jan Blaha
    @pofider
    @wastaz Do you render pdf using chrome pdf? The chrome rendering is typically the bottleneck. Try this configuration and limit the number of concurent instances
    Fred
    @wastaz
    Ill give it a shot :)
    Jan Blaha
    @pofider
    in a more complex environments, you also typically employ a webserver like nginx to be used as reverse proxy to jsreport. And there are plenty of options to limit the number of parallel requests in nginx. But better to start with just with jsreport configs if you don't have web server running in front
    Fred
    @wastaz
    Sadly we dont have a webserver in front of it currently and if we did I think our ops team would insist on it being IIS instead of nginx :(
    Can probably limit stuff in IIS as well though somehow, just need to find the right clicky clickies...
    swiftinitdotcom
    @swiftinitdotcom
    is this really good tool for dotnet blazer
    projects
    Madhusudan
    @sudkhd
    I am trying add colspan on xlxs with cheerios page eval. does not seem to work. is there a way to merge cols
    ?
    Jan Blaha
    @pofider
    Madhusudan
    @sudkhd
    thanks, let me check
    May Thu Khaing
    @khine:matrix.org
    [m]
    hello ,how can i change custom report name
    Jan Blaha
    @pofider
    {
          "template": { ... },
          "options": { "reportName": "myreport" }
    }