Skip to content

PDF export error: “The input string '3322.5' was not in a correct format” #894

@emirhantekik

Description

@emirhantekik

Hi balkanapp team,

I am trying to export my chart to PDF, but I consistently get the following error:

The input string '3322.5' was not in a correct format.
at System.Number.ThrowFormatException[TChar](ReadOnlySpan`1 value)
at Services.ExportService.GetSvgAttributes(String svgText) in C:\Development\TFS\balkan.app\BALKAN\serverjs.balkan.app\Services\ExportService.cs:line 492
at Services.ExportService.DoPuppeteerWorkSync(String dir, String type, ExportOptions options, AppConfiguration config) in C:\Development\TFS\balkan.app\BALKAN\serverjs.balkan.app\Services\ExportService.cs:line 393
at Services.ExportService.ToPDF(ExportOptions options) in C:\Development\TFS\balkan.app\BALKAN\serverjs.balkan.app\Services\ExportService.cs:line 218
at Controllers.ExportController.PDF(ExportOptions options) in C:\Development\TFS\balkan.app\BALKAN\serverjs.balkan.app\Controllers\ExportController.cs:line 100

When I inspect the DOM (via F12 → Elements), I see elements like this:

<g data-ctrl-ec-id="125267" transform="matrix(1,0,0,1,3322.5,245)" style="cursor:pointer;">
    <circle cx="15" cy="15" r="12" fill="#f0f4ff" stroke="#f0f4ff" stroke-width="1"></circle>
    <line x1="10" y1="15" x2="20" y2="15" stroke-width="2" stroke="#6C8FF5"></line>
</g>

It seems the transform attribute contains decimal values (e.g. 3322.5), which might be causing the parsing issue.

What confuses me is that in your documentation example (e.g. PDF preview with custom pages
), nodes also contain decimal values such as: (example : janae barrett)

<g data-ctrl-ec-id="3" transform="matrix(1,0,0,1,882.5,285)" style="cursor:pointer;">...</g>

But in that case, the PDF export works fine.

I also tried manipulating the DOM and rounding the transform values to integers, but the PDF export still throws the same error.

Could you please clarify why this happens, and what is the correct way to fix it so that I can successfully export charts to PDF?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions