Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with SVG in PDF #1971

Closed
1 task
satish123satish123 opened this issue Dec 15, 2023 · 3 comments
Closed
1 task

Problem with SVG in PDF #1971

satish123satish123 opened this issue Dec 15, 2023 · 3 comments

Comments

@satish123satish123
Copy link

satish123satish123 commented Dec 15, 2023

Guidelines

Description of the bug

I am using chart.js and canvas2svg.js to convert chart to svg and getting svg code with
var svgCode = svgContext.getSerializedSvg(true)
I am passing this svgCode to my ajax call in a php file and trying to add svgCode in WriteHtml() function and getting following error

Fatal error: Uncaught TypeError: Unsupported operand types: string * float in D:\www\test\vendor\mpdf\mpdf\src\Image\Svg.php:1488

when I replace following code in Svg.php line no 1488 its working

$arr .= sprintf('%.3F %.3F ', (float)$d[$i] * $this->kp, (float)$d[$i + 1] * $this->kp);

mPDF version

8.2

PHP Version and environment (server type, cli provider etc., enclosing libraries and their respective versions)

8.1

Reproducible PHP+CSS+HTML snippet suffering by the error

Desktop-screenshot

@finwe
Copy link
Member

finwe commented Dec 15, 2023

What is reproducible about a browser screenshot? Provide the svg and php code.

@finwe finwe closed this as completed Dec 15, 2023
@satish123satish123
Copy link
Author

satish123satish123 commented Dec 15, 2023

chart (4)

This is my svg code

@finwe
Copy link
Member

finwe commented Dec 16, 2023

Unable to reproduce, the PDF with this image is generated correctly without errors (mPDF 8.2.3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants