Hi there
I found this thread that explains how to print from krpano
But couldn't find the actual plugin anywhere - is it available to download anywhere ?
Thanks in advance
Stevew
Hi there
I found this thread that explains how to print from krpano
But couldn't find the actual plugin anywhere - is it available to download anywhere ?
Thanks in advance
Stevew
Hi,
I'm not sure if that plugin was offered anywhere anytime...
but you can try compiling the plugin from that thread by yourself...
Here a tutorial for mxmlc usage (the Flash compiler)
http://www.senocular.com/flash/tutorials/as3withmxmlc/
See also the krpano plugin development documentation:
https://krpano.com/docu/plugininterface/#top
or here the old version of it (which relates better to the posted code):
https://krpano.com/docu/plugininterface/?version=107
Best regards,
Klaus
Hi Klaus
I'll give it a go - thanks for the useful pointers
Steve
Just wanted to say that I got the print going successfully so thanks again Klaus.
As a bonus I managed to take that script and develop a very similar one to copy an image out of the current view and save it to a file (JPEG though it could be PNG).
It uses the JPGEncoder from the as3corelibrary and seems to work great.
It's here for anyone if they would like to use it.
package{import flash.display.Sprite;
import flash.events.*;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Matrix;
import krpano_as3_interface;
import flash.net.FileReference;
import flash.net.FileFilter;
import flash.utils.ByteArray;
import com.adobe.images.JPGEncoder;
public class saveimage extends Sprite
{private var krpano : krpano_as3_interface = null;
private var pluginobject:Object = null;
public function saveimage ()
{if (stage == null)
{addEventListener(Event.ADDED_TO_STAGE, startplugin);
addEventListener(Event.REMOVED_FROM_STAGE, stopplugin);
}}
private function startplugin(evt:Event):void
{this.removeEventListener(Event.ADDED_TO_STAGE, startplugin);
if (krpano == null)
{// setup krpano interface
krpano = krpano_as3_interface.getInstance();
pluginobject = krpano.get("plugin[save360]");
pluginobject.savefunction = savefile;
} }
private function stopplugin(evt:Event):void
{//STOP}
private function savefile():void
{
krpano.set("plugin.visible", "false");
krpano.set("hotspot.visible", "false");
var frame:Sprite = new Sprite();
var bitmap:BitmapData = new BitmapData (stage.stageWidth, stage.stageHeight);
var matrix:Matrix = new Matrix();
var wstage:Number = stage.stageWidth;
var hstage:Number = stage.stageHeight;
var rect1:Rectangle = new Rectangle(0, 0, wstage, hstage);
bitmap.draw(stage.root);
frame.graphics.beginBitmapFill(bitmap, matrix, true);
frame.graphics.drawRect(0, 0, wstage, hstage);
frame.graphics.endFill();
addChild(frame);
//save element
// Set the encoding to high-quality
var qEncoder:JPGEncoder = new JPGEncoder(100);
var qBytes:ByteArray = qEncoder.encode(bitmap);
var qFile:FileReference = new FileReference();
qFile.save(qBytes, "imageexport.jpg");
krpano.set("plugin.visible", "true");krpano.set("hotspot.visible", "true");
removeChild(frame);
}
}
}
Display More
It can be called in a similar way to the doprint script
i.e.:
<plugin name="saveimage" url="%HTMLPATH%/saveimage.swf" />
<contextmenu>
<item name="item_save" caption="Save View to JPEG" onclick="plugin[saveimage].savefunction();" />
One good turn and all that!
Steve
SteveW, this is a great feature, would you care to make the plugin downloadable?
Don’t have an account yet? Register yourself now and be a part of our community!