Gisellameloni / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
0 stars 0 forks source link

How to call Export to PNG function while using iframe. #1201

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I have try to exporting image as png in your embedapi.html through the object 
"svgCanvas" but i failed to do this.

Can you please suggest some solution for this.

Many thanks
Jevis

Original issue reported on code.google.com by jevi...@gmail.com on 7 Apr 2014 at 6:22

GoogleCodeExporter commented 9 years ago
I've updated trunk to support export via embedapi.js and demonstrated it in the 
new version of embedapi.html: 
http://svg-edit.googlecode.com/svn/trunk/editor/embedapi.html

Please confirm it is working ok for you and I will close the issue.

Original comment by bret...@gmail.com on 9 Apr 2014 at 7:02

GoogleCodeExporter commented 9 years ago
Hi,

Yes, this is very useful information what you have explain through the demo.

I have seen that in rasterExport function call "svgCanvas.rasterExport('PNG', 
null, exportWindow.name);" third argument in this function is passing window 
object to open the image in new window.

But i don't want to open image in a new window i just need to save the image 
into DB. so need PNG data in variable.

Please if you can help me out in this then it would be more helpful to me.

Many thanks,
Jevis

Original comment by jevi...@gmail.com on 9 Apr 2014 at 5:16

GoogleCodeExporter commented 9 years ago
Ok, I will try to look into this when I may have some time.

Original comment by bret...@gmail.com on 11 Apr 2014 at 9:43

GoogleCodeExporter commented 9 years ago
Ok...Great Thanks !

Original comment by jevi...@gmail.com on 14 Apr 2014 at 4:56

GoogleCodeExporter commented 9 years ago
Sorry, just to let you know that due to factors beyond my control it may be 
quite a bit longer until I can get to this--maybe a month or so.

Original comment by bret...@gmail.com on 16 Apr 2014 at 10:42

GoogleCodeExporter commented 9 years ago
Hi ,

Is there any updates ?

Many thanks
Jevis

Original comment by jevi...@gmail.com on 3 May 2014 at 7:19

GoogleCodeExporter commented 9 years ago
As I said, it may take me a month or so to get to this.

Original comment by bret...@gmail.com on 3 May 2014 at 9:39

GoogleCodeExporter commented 9 years ago
Hey, and sorry if that sounded curt... I'm just too pressed to be able to do 
anything on it now! (But I don't expect it to take too long when I do get a 
sufficient block of free time.)

Original comment by bret...@gmail.com on 6 May 2014 at 6:56

GoogleCodeExporter commented 9 years ago

Original comment by bret...@gmail.com on 8 May 2014 at 3:21

GoogleCodeExporter commented 9 years ago
Hi Jevis,

I finally got around to this... Check out trunk... The embedded editor now 
demonstrates PDF export, and in the comments, in a new file embedapi-dom.js 
(which just contains the old code which used to be directly within the HTML) 
shows how to override the default. Let me know if a data URI is not a suitable 
way of serializing an image for you. Please confirm everything is working ok, 
so I can close the issue.

Original comment by bret...@gmail.com on 22 May 2014 at 10:31

GoogleCodeExporter commented 9 years ago
Hi Brett,

Thanks for the quick response, but i think my requirement is only i want image 
data on "Export as PNG" button so i can save that data into SQL Sever.

My originally requirement is only that, i want image data string on button 
using embedded API.
I had never asked about any PDF export.

Many thanks
Jevis

Original comment by jevi...@gmail.com on 1 Jun 2014 at 5:23

GoogleCodeExporter commented 9 years ago
Ah, sorry, I jumbled these two together in my mind, but that was part of the 
goal too. I have added support in trunk.

You can now call it like this from the embedded code:

svgCanvas.bind('exported', function (win, data) {
    alert(data.datauri);
});
svgCanvas.rasterExport('PNG');

Please confirm it is working for you.

Original comment by bret...@gmail.com on 1 Jun 2014 at 9:32

GoogleCodeExporter commented 9 years ago
FYI, if you want to allow a view of the svg-editor.html to also support your 
database-saving export, you can also add your functionality as an extension in 
the following manner:

// Create a file prefixed with "ext-" in the extensions directory, like 
"ext-exportImage.js", add the following code, and then add 
"?extensions=ext-exportImage.js" to the svg-editor.html URL:

svgEditor.addExtension("exportImage", {
    callback: function() {
        svgEditor.setCustomHandlers({
            exportImage: function (win, data) {
                alert(data.datauri);
            }
        });
    }
});

Original comment by bret...@gmail.com on 1 Jun 2014 at 9:46

GoogleCodeExporter commented 9 years ago
Sorry brett, But I am not able to find any changes in trunk.

Can you pleas provide me working trunk link.

Thanks
Jevis

Original comment by jevi...@gmail.com on 2 Jun 2014 at 6:27

GoogleCodeExporter commented 9 years ago

http://svg-edit.googlecode.com/svn/trunk/editor/svg-editor.html

http://svg-edit.googlecode.com/svn/trunk/editor/embedapi.html

Original comment by bret...@gmail.com on 2 Jun 2014 at 7:27

GoogleCodeExporter commented 9 years ago
Hi,

I am not able to find any amendments in the trunk still it open image in new 
window.

Thanks
Jevis

Original comment by jevi...@gmail.com on 4 Jun 2014 at 12:21

GoogleCodeExporter commented 9 years ago
I did not change the behavior of the demo--I changed the code so you can change 
it as you need. You have to get the code from SVN and use the code sample I 
published in this issue.

Original comment by bret...@gmail.com on 4 Jun 2014 at 1:00