@fabwcie/free-drawing / utils/embeddedDrawing
utils/embeddedDrawing
Functions
embedDrawingInPng()
embedDrawingInPng(
png,json):Promise<Blob>
Defined in: packages/free-drawing/src/utils/embeddedDrawing.ts:51
PNG image keeping a drawing: text chunk added before its end
Parameters
png
Blob
PNG image (exported drawing)
json
string
JSON of the drawing file
Returns
Promise<Blob>
PNG image with the drawing
embedDrawingInSvg()
embedDrawingInSvg(
svg,json):Promise<string>
Defined in: packages/free-drawing/src/utils/embeddedDrawing.ts:75
SVG image keeping a drawing: metadata element at its start
Parameters
svg
string
SVG image (exported drawing)
json
string
JSON of the drawing file
Returns
Promise<string>
SVG image with the drawing
readDrawingFile()
readDrawingFile(
file):Promise<string>
Defined in: packages/free-drawing/src/utils/embeddedDrawing.ts:116
JSON of a drawing file chosen to be opened: a drawing file, or a PNG or SVG image keeping its drawing
Parameters
file
Blob
File chosen by the user
Returns
Promise<string>
JSON of the drawing file (checked when loaded)
Throws
image without drawing, or its drawing damaged or too big