Set viewport height and viewport width from api call (dotnet)
-
Is there a way to achieve this, I'm using handlebars, chrome-image
In dotnet using jsreport.Client im calling something like this but it doesn't work:
var renderRequest = new jsreport.Types.RenderRequest
{Template = new Template { Name = "compare", Chrome = new Chrome { Width = $"{100}px", Height = $"{150}px", }, }, Data = new { DataSeries = this.ChartService.DataSeries, Currency = this.ChartService.Currency, CultureName = this.ChartService.CultureName, SeriesColors = this.seriesColors, FontSize = this.ChartService.CustomSettings["fontsize"] }, };
for chrome image I see I can only set clip sizes but I want to set the viewport width and height as a whole
-
In the case of the chrome-image recipe, you should use
Template.ChromeImage
https://github.com/jsreport/jsreport-dotnet-types/blob/master/jsreport.Types/Request/Template.cs#L51There you want to use the
ClipHeight
andClipWidth
properties likely.
https://github.com/jsreport/jsreport-dotnet-types/blob/master/jsreport.Types/Request/ChromeImage.cs#L9
-
I tried that first something like this:
var renderRequest = new jsreport.Types.RenderRequest
{
Template = new Template
{Name = "compare", ChromeImage = new ChromeImage { ClipX = 0, ClipY = 0, ClipHeight = 100, ClipWidth = 150, } }, Data = new { DataSeries = this.ChartService.DataSeries, Currency = this.ChartService.Currency, CultureName = this.ChartService.CultureName, SeriesColors = this.seriesColors, FontSize = this.ChartService.CustomSettings["fontsize"] }, };
but the result is that the height and width are set as default then 800 and 600 so when i clip it i get part of the picture
![alt text]( image url)
i need to change these values
![alt text]( image url)
i can't seem to find how to do this
-
I see, sorry. The view port setting was really missing. I've pushed a 3.9.3 update of
jsreport-dotnet-types
nuget which includes these types.https://github.com/jsreport/jsreport-dotnet-types/commit/fc525fc01f2544194473e739ce2a21a2e4937a4a
-
This was exactly what was needed! Thank you very much!