If you want to save the surface "somewhere" but not necessarily in a user-accessible location, you could use buffer_get_surface and then buffer_base64_encode to convert it to a string you could save (or, perhaps, buffer_save will also work).
Thanks for your reply. I tried some way, maybe the problem is at my end, but could not get it work.
Surface_save works well on windows.exe (but not with html5), however buffer_get_surface+buffer_save or buffer_get_surface+buffer_base64_encode+file_text_write_string did not work at all.
Anyway, thank you.