Hello Syncfusion team,
I'm using the latest available version of the diagram component ("@syncfusion/ej2-angular-diagrams": "^19.4.43") in my app.
Since I use SVG nodes in my app, I have to use the
getDiagramContent() method and send the output to a backend server that prints it using the HtmlToPdfConverter.
I'm noticing a regression in the getDiagramContent() method in the latest version.
If I scroll above (or to the left of) a diagram's page break, then the
getDiagramContent() method wrongly clips the content.
However, if I scroll below (or to right of) the page break, then the method works properly.
Please see attached gif for details. I've also attached the diagram json.
My diagram page settings are as follows:
Thanks,
-Mithun
Attachment: getdiagramcontentissue_a7f88936.zip
Hi Mithun,
On further of shared JSON data we have created a sample by loading the JSON and exported as image, but we couldn’t be able to replicate the issue in our end. We request you to replicate the issue in the shared sample so that we can be able to serve you better.
Sample Link: https://stackblitz.com/edit/angular-zfkdz6-zmwtyp?file=app.component.ts
Regards,
Arun Kumar.
Hi Arun,
Your example does not use the getDiagramContent() method.
Hence you're not encountering the issue.
As I had previously mentioned,
since my app uses SVG nodes, I have to use the
getDiagramContent() method and send the output to a backend server that prints it using the HtmlToPdfConverter.
Thanks,
-Mithun
Hi Mithun,
Sorry for the inconvenience.
We will validate your issue and update you with more details on 31st january, 2022.
Regards,
Shya
Hi Mithun,
We have checked your issue by loading your JSON in our sample and exported it to PDF using Webkit converter and we could not be able to replicate an issue at our end. Could you please share us more details such as modifying the below sample. We have provided a video in which we have shown how to run our sample and tried to replicate your issue.
Regards,
Arun Kumar.
Hi Arun,
I'll try to update the sample.
In the meanwhile, you can try out this scenario from my app (test version, where the output of getDiagramContent() is being shown in the browser console).
Thanks,
-Mithun
Hi Arun,
I've managed to reproduce the error.
I've forked your original stackblitz project twice as follows:
Attachment: video1329082616_79ce08ee.zip
Hi Mithun,
|
When we load your JSON, the page starts from negative x axis -240. In our previous version(19.4.40), when we export the diagram, we consider from x axis 0 and ignored the negative axis. In the latest version(19.4.48), when we export the diagram, we have considered the negative axis and it starts from -240. So only the spaces appear at the left in the latest version.
|
|
The other issue is that the getDiagramBounds() method returns the same Rect dimensions in both examples (I'm outputting this to the browser console in both stackblitz projects). While the Rect dimensions are correct for the older version, it is wrong for the newer version. |
The getDiagramBounds method will return the diagram content bounds. When we load your JSON, the diagram content bounds starts from x and y axis 0, so the Rect returns correct value in both older and newer versions. |
Regards,
Arun Kumar.
Hi Arun,
Then, in the new version, how can I figure out the correct values required to initialize the WebKitConverterSetting's viewport (needed to print the diagram)?
Previously, I was using the Rect output of getDiagramContent() method and using it to initialize WebKitConverterSettings.
in the newer version, while the
Rect output of getDiagramContent()
has the correct width & height, the origin is no longer (0,0).
This is causing the generated diagram to get clipped.
How can I programmatically get the values of the negative axes (if any)?
I'll be happy to a video/conf call to go over the details (this issue is somewhat critical for us).
Thanks,
-Mithun
Hi Mithun,
The scroller hOffset and vOffset will return the negative values of horizontal and vertical offset respectively. So, you should add hOffset/vOffset with the viewportWidth in the settings WebKitViewPort width and height should be set as 0. We have created a sample in which we have shown how to get scroller hOffset,vOffset and viewPortWidth. You need to pass HTML content and the width in the server side to convert HTML content to PDF
Code snippet:
|
getContent() { let oldwidth = this.diagram.scroller.vPortWidth; let width = this.diagram.scroller.vPortWidth; if (this.diagram.scroller.vOffset > this.diagram.scroller.hOffset) { width = width + this.diagram.scroller.vOffset; } else { width = width + this.diagram.scroller.hOffset; } let content = this.diagram.getDiagramContent(); let updatedwidth = this.diagram.scroller.vPortWidth; } |
Sample Link: https://stackblitz.com/edit/angular-zfkdz6-fbyfnw?file=app.component.ts
Regards,
Arun Kumar.
Hi Arun,
Thanks for the suggestion & sample. I'll try it out and revert back later today.
Thanks,
-Mithun
Hi Mithun,
We will wait to hear from you.
Regards,
Shyam G
@Shyam: Yes, from my initial tests, this suggested workaround (using scroller offsets) seems to work. I haven't extensively tested it, but we can safely mark this issue as resolved.
@Arun: Thanks again for all the help on this! Highly appreciated.
I'll test this in my pre-production environment over the coming days. Will open a separate forum thread should I encounter any edge cases.
Thanks,
-Mithun
Hi Mithun,
Thanks for your update.
Regards,
Shyam G