Store fabricJS objects to export in a PDF #8341
Replies: 3 comments 2 replies
-
|
Beta Was this translation helpful? Give feedback.
-
@MallauryGerard We implement solution 1, as we are catering for the print industry, which requires every text or shape to remain vectorized in the PDF. What we do is, when implementing the To render the PDF, you can use TCPDF since you have PHP. It renders SVGs very easily: TCPDF |
Beta Was this translation helpful? Give feedback.
-
Thank you both, I will analyse your answers. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am using FabricJS as a layer on top of a PDFJS to allow annotating a PDF (page by page).
I am now looking to export the annotated PDF (I have a Laravel/PHP backend).
I see 2 solutions:
1. Save the fabric objects in the database (JSON). Then recreate each object in the PDF with the FPDF library.
The problem is that the coordinates of the fabricJS objects do not match the coordinates of FPDF. And so I can't reposition the objects to the right place on the page (nor to the right size).
2. Save the annotations in base64 in the database (with the toDataUrl function)
The problem here is the size of the base64 that will have to be saved for each page of the PDF...
Do you have any tips to help me implement solution 1. Or is there a way to convert a json fabric to an image directly in PHP?
Or do you have any other ideas?
Thanks !!
Beta Was this translation helpful? Give feedback.
All reactions