File tree Expand file tree Collapse file tree 3 files changed +9831
-9912
lines changed
projects/angular-editor-fabric-js/src/lib Expand file tree Collapse file tree 3 files changed +9831
-9912
lines changed Original file line number Diff line number Diff line change @@ -559,14 +559,36 @@ export class FabricjsEditorComponent implements AfterViewInit {
559559 image . src = this . canvas . toDataURL ( { format : 'png' } ) ;
560560 const w = window . open ( '' ) ;
561561 w . document . write ( image . outerHTML ) ;
562+ this . downLoadImage ( ) ;
563+ }
564+
565+ downLoadImage ( ) {
566+ const c = this . canvas . toDataURL ( { format : 'png' } ) ;
567+ const downloadLink = document . createElement ( 'a' ) ;
568+ document . body . appendChild ( downloadLink ) ;
569+ downloadLink . href = c ;
570+ downloadLink . target = '_self' ;
571+ downloadLink . download = Date . now ( ) + '.png' ;
572+ downloadLink . click ( ) ;
562573 }
563574
564575 rasterizeSVG ( ) {
565576 const w = window . open ( '' ) ;
566577 w . document . write ( this . canvas . toSVG ( ) ) ;
578+ this . downLoadSVG ( ) ;
567579 return 'data:image/svg+xml;utf8,' + encodeURIComponent ( this . canvas . toSVG ( ) ) ;
568580 }
569581
582+ downLoadSVG ( ) {
583+ const c = 'data:image/svg+xml;utf8,' + encodeURIComponent ( this . canvas . toSVG ( ) ) ;
584+ const downloadLink = document . createElement ( 'a' ) ;
585+ document . body . appendChild ( downloadLink ) ;
586+ downloadLink . href = c ;
587+ downloadLink . target = '_self' ;
588+ downloadLink . download = Date . now ( ) + '.svg' ;
589+ downloadLink . click ( ) ;
590+ }
591+
570592 saveCanvasToJSON ( ) {
571593 const json = JSON . stringify ( this . canvas ) ;
572594 localStorage . setItem ( 'Kanvas' , json ) ;
Original file line number Diff line number Diff line change 11< div class ="container ">
22 < div class ="row ">
33 < div class ="col-xl-12 main-title ">
4- < h4 > Github: < a href ="https://github.com/kevoj /angular-editor-fabric-js "> angular-editor-fabric-js</ a > </ h4 >
4+ < h4 > Github: < a href ="https://github.com/saqib92 /angular-editor-fabric-js "> angular-editor-fabric-js</ a > </ h4 >
55 </ div >
66 < div class ="col-xl-12 ">
77 < div class ="row ">
You can’t perform that action at this time.
0 commit comments