Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

How to print a HTMLLoader?

$
0
0

Hey!

 

I want to load a htmlstring into a new htmlloader-object and print it via  window.runtime.flash.printing.

unfortunately, my printer prints only blank pages.

 

air tells me that  "Error #2057: The page could not be added to the print job" occured.

 

Does anybody know how i can load html-content into a air-window and how i can send the content to the printer?

 

My code in air is

 

var pjob = new window.runtime.flash.printing.PrintJob;

var options = new air.NativeWindowInitOptions();

options.systemChrome = "none";

options.type = "lightweight";

var windowBounds = new air.Rectangle(200,250,300,400);

var htmlStr = "<html><body>Hello <b>world</b>.</body></html>";

 

newHTMLLoader = air.HTMLLoader.createRootWindow(true, options, true, windowBounds);

newHTMLLoader.loadString(htmlStr);

if (pjob.start()) {

var poptions = new window.runtime.flash.printing.PrintJobOptions;

poptions.printAsBitmap = true;

 

try {                pjob.addPage(newHTMLLoader.htmlLoader, null, poptions);

}            catch (e) {

air.trace(e);

}

try {                pjob.send();

}            catch (err) {

air.trace(err);           }

}      else {           air.trace("PrintJob couldn't start");      }


Viewing all articles
Browse latest Browse all 21156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>