
Quote from noyzen on June 2, 2023, 3:38 pmHi guys,
I'm using FabricJS to make a very simple app.
I Use Website2APK builder to make APK and it solve problem with CORS origins.
(Has an option to allow it)But when I want save final file to jpg or png I get an error in Android and it says only can save http or https content and FabricJS gives blob format. (SaveFile command in Fabric)
I know that there is a command fabSaveAsBase64 and then Base64ToLocalFile I never tested that, because I don't know what format will be generated file... jpg? png? svg?
and if it is JPG can I change quality like fabSaveAsJPG?EDIT: I have tested that method above and I get same error (blob format)
Is there any way to fix that?
So I can make Android apps with FabricThanks :)
Hi guys,
I'm using FabricJS to make a very simple app.
I Use Website2APK builder to make APK and it solve problem with CORS origins.
(Has an option to allow it)
But when I want save final file to jpg or png I get an error in Android and it says only can save http or https content and FabricJS gives blob format. (SaveFile command in Fabric)
I know that there is a command fabSaveAsBase64 and then Base64ToLocalFile I never tested that, because I don't know what format will be generated file... jpg? png? svg?
and if it is JPG can I change quality like fabSaveAsJPG?
EDIT: I have tested that method above and I get same error (blob format)
Is there any way to fix that?
So I can make Android apps with Fabric
Thanks :)

Quote from luishp on June 4, 2023, 5:48 pm@noyzen I don't understand why are you having such a problem. Have you checked the included sample app in this location?:
My Documents\VisualNeoWeb\Sample Apps\FabricCanvasRegards.
@noyzen I don't understand why are you having such a problem. Have you checked the included sample app in this location?:
My Documents\VisualNeoWeb\Sample Apps\FabricCanvas
Regards.

Quote from noyzen on June 4, 2023, 9:04 pmYes, I have checked Sample apps and It works on server.
But as offline app in android FabricJS can not save file, I get an error which says URI must be http or https but Its blob.
Yes, I have checked Sample apps and It works on server.
But as offline app in android FabricJS can not save file, I get an error which says URI must be http or https but Its blob.

Quote from luishp on June 6, 2023, 12:13 pm@noyzen, not sure but you can try to convert the blob URI to a data URI. A data URI allows you to embed data directly into the URL, which can be used for images, files, or other types of data. To convert a Blob to a data URI, you can use the FileReader API. Here's an example:
BeginJS reader = new FileReader(); reader.onload = function(event) { $App.dataURI = event.target.result; // Use [dataURI] in neoScript }; reader.readAsDataURL($App.blob); // [blob] refers to your Blob object EndJS
@noyzen, not sure but you can try to convert the blob URI to a data URI. A data URI allows you to embed data directly into the URL, which can be used for images, files, or other types of data. To convert a Blob to a data URI, you can use the FileReader API. Here's an example:
BeginJS
reader = new FileReader();
reader.onload = function(event) {
$App.dataURI = event.target.result; // Use [dataURI] in neoScript
};
reader.readAsDataURL($App.blob); // [blob] refers to your Blob object
EndJS

Quote from noyzen on June 7, 2023, 10:10 amThank you Luis,
This command: fabSaveAsJPG gives the blob URI. how can I use your JS code with command?
I think you can try to edit FabricJS plugin, I need to export canvas for JPG (with quality setting) and PNG like what Fabric doing now in desktop server.
FabricJS is amazing plugin!
Thank you Luis,
This command: fabSaveAsJPG gives the blob URI. how can I use your JS code with command?
I think you can try to edit FabricJS plugin, I need to export canvas for JPG (with quality setting) and PNG like what Fabric doing now in desktop server.
FabricJS is amazing plugin!