Printing in Adobe AIR (JavaScript / Ajax) whereas skipping the print dialogue

Hi,
Can I do what the topic says? Basically I would like to check with a timer a URL and once something appears there I want it to be sent directly to my default printer.
Is that possible? And if Yes, how?
thank you,
George

Hi, I have not investigated exactly your problem as yet but this seems to be related to it:
http://anirudhs.chaosnet.org/blog/2008.02.15.html
For me it was printing only the upper-left corner
but specifing a Rectangle for size for PrintJob.addPage() second argument fixed that
please consult
http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context =LiveDocs_Parts&file=00000334.html
for help on Rectangle. You can use geom instead of display;
frameworks/libs/air/AIRAliases.js contains an alias directly to geom:
air.Rectangle = window.runtime.flash.geom.Rectangle;
so you may use directly air.Rectangle to construct the size.
It works on AIR 1.5 as well as AIR 2 beta
Code snippet I have used and worked:
function doPrintAir()
    var pjob = new window.runtime.flash.printing.PrintJob;
    if ( pjob.start() )
        var poptions = new window.runtime.flash.printing.PrintJobOptions;
        var rectangle = new air.Rectangle(0, 0, 800, 800);
        poptions.printAsBitmap = true;
        /* poptions.pixelsPerInch = 300; */
        try
            pjob.addPage(window.htmlLoader, rectangle, poptions);
            pjob.send();
        catch (err)
            alert("exception: " + err);
    else
        alert("PrintJob couldn't start");
//comment the line below if you do not want to mess with existing
//window.print
window.print = doPrintAir;
this make js window.print() available for use as one would normay do.
Let me know if this helps and fixes your problem.
Best regards,
Daniel Baragan - Adobe AIR Engineer

Similar Messages

  • Adobe AIR (JavaScript/AJAX) is dead?

    Hi all,
    I used to code in AIR for JavaScript / Ajax in v1 and v1.5 of AIR. I am trying to refresh my coding skills into this platform but there seems to be very poor knowledge base and material at the web, I am wondering whether this platform is somehow deprecated and whether only Adobe AIR (Flex) is supported.
    Can you please clarify?
    thank you,
    George

    Bump! I'd like to know, too. We have a large html/javascript app and are wanting to use it on Android or iOS, but it kinda seems like everything is Flex based now.... ???
    - Jack

  • Link in Adobe AIR JavaScript app is incorrectly opening the app in the default browser

    I have a couple of links in my Adobe AIR JavaScript app that are part of the app's UI, which when clicked are causing the app to be loaded into a new tab in my default browser.
    This is only happening with two links (Save and Cancel on a form), and not all links in my UI.  The two links that are having the issue are defined in an external HTML file that I load a runtime and connect to the DOM.  The links that are defined in the main HTML file that is loaded when the app starts up do not have this problem.
    Here is how I am loading the template and plugging it into the DOM
    var win = document.createElement("div");
    var f = air.File.applicationDirectory.resolvePath("lib/partials/edit_form.html");
    var fs = new air.FileStream();
    fs.open(f, air.FileMode.READ);
    var content = fs.readUTFBytes(fs.bytesAvailable);
    fs.close();
    var template = new Template(content);
    win.innerHTML = template.evaluate(data);
    document.body.insertBefore(win, document.body.firstChild);
    The links themselves are coded like this:
    <a href="#" id="save_button" onclick="return false;"></a>
    <a href="#" id="cancel_button" onclick="return false;"></a>
    I am using the Prototype JS library to observe the 'click' event for each of these links like so:
    $('save_button').observe('click', onSave);
    $('save_button').observe('click', onCancel);
    This app shows content created by users, which can contain links to external web sites.  To get the external links to open in the browser (as opposed to inside my Adobe AIR window), I am doing the following in a script tag in the head of my main HTML file:
    window.htmlLoader.navigateInSystemBrowser = true
    I've found that if I set window.htmlLoader.navigateInSystemBrowser = false, then the issue with the Save and Cancel links described above goes away.  However, I need to have window.htmlLoader.navigateInSystemBrowser = true so that external links in the user content open up in the browser, not in Adobe AIR.
    Another piece of evidence is that the Save and Cancel links only incorrectly open a browser the first time you click on them after launching the app.  Subsequent clicks work fine and do not have the issue.
    Any ideas on why the links that are plugged into the DOM after app start up have this issue, and only the first time you click on them?

    Not sure where this comes from, but I suspect it has something to do with the security restrictions that AIR has in place, related to dynamic JS evaluation after the document is loaded.
    Make sure you read http://help.adobe.com/en_US/air/html/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7f0e.html#WS 5b3ccc516d4fbf351e63e3d118666ade46-7ef8
    For example, I've spotted the two onclick="return false;" you have in your code. The evaluation of the onclick attribute after the page loaded event would fail in AIR.

  • How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    How to get the data from mysql database which is being accessed by a PHP application and process the data locally in adobe air application and finally commit the changes back in to mysql database through the PHP application.

    If the data is on a remote server (for example, PHP running on a web server, talking to a MySQL server) then you do this in an AIR application the same way you would do it with any Flex application (or ajax application, if you're building your AIR app in HTML/JS).
    That's a broad answer, but in fact there are lots of ways to communicate between Flex and PHP. The most common and best in most cases is to use AMFPHP (http://amfphp.org/) or the new ZEND AMF support in the Zend Framework.
    This page is a good starting point for learning about Flex and PHP communication:
    http://www.adobe.com/devnet/flex/flex_php.html
    Also, in Flash Builder 4 they've added a lot of remote-data-connection functionality, including a lot that's designed for PHP. Take a look at the Flash Builder 4 public beta for more on that: http://labs.adobe.com/technologies/flashbuilder4/

  • Adobe Air I get this message: The application could not be installed because the installer file is damaged....

    Every time I try to install new product through adobe air I get this message: The application could not be installed because the installer file is damaged. Try obtaining a new installer file from the application author. Kiran Kumar: May I have the product name and version you are referring to? I've looked over the online suggested repair which indicates to search for and delete Adobe Muse but when go looking for it, it doesn't seem to exist. How can I get this resolved?

    Finally found a fix on my own....Wasted like 3 hours today. Hope this helps for anyone struggling with that stupid error message:

  • Is anybody else having their Adobe AIR iOS app crash within the first second of opening it?

    Is anybody else having their Adobe AIR iOS app crash within the first second of opening it?
    I am using iPhone 6, iOS 8.1.3, with a development certificate.
    With Adobe AIR SDK 16.0.0.283 and now with 17.0.0.93, after compiling the app (whether in release mode or debug mode), before the app getTimer() can ever reach 999 milliseconds the app will crash. No matter what code I have, it is just crashing before the runtime can ever reach the first second.
    Anybody else having this kind of behavior?

    Chris,
    Thanks for your prompt reply. I have found the way to reproduce. It is about interfaces, and when I try to call a method through an interface the app crashes. I think that it is related to having an interface with many parameters. I have logged the bug here:
    Bug#3935199 - iOS App crashes when calling an objects method through interface

  • Adobe Air (Javascript) Barrierefreiheit

    Kann mir jemand sagen wie weit Adobe Air Applicationen Barrierefrei entwickelnt werden können.
    Die visuellen vorraussetzungen wie Kontrast und Schriftgröße sind ja zu realisieren.
    Aber wie sieht es mit der Funktionalität mit Screenreadern und anderen Vorraussetzungen aus?
    Mit der Verwendung von Flex gibt es ja einige Informationen nur leider habe ich nichtz zu JavaScript gefunden, oder kann ich eine Adobe Air Application wie einen Browser ansehen?

    Also, ich kann momentan nix mit einem Screenreader ausprobieren, weil meine Soundkarte kaputt ist ;-)
    Am besten mal den Thunder Screenreader installieren und probieren, ob der mit einer HTML/Javascript - basierten AIR-Anwendung zurecht kommt.

  • Have to reinstall adobe photoshop cs4, but adobe AIR version no longer supports the version need an updated version?

    Have to reload adobe photoshop cs4, but the adobe AIR version is not longer supported.  Where can I download the updated version to support the program?

    http://get.adobe.com/air/

  • Adobe air exe to ios app - the process?

    Hi,
    I am new to app development. I am wanting to know what is possible and my cheapest option in creating an app for IOS from windows.
    The app I am creating is a technical publication wanting to be displayed on anipad.
    I have an adobe Air version exe published from robohelp/ framemaker. Is there a way to turn my adobe air application into a IOS App?
    If not, what are my other options to get a tech pubs document as a IOS App? I would like to use ideally windows adobe products for the creation of it.
    Thanks

    Ye that Merapi definitely seems interesting but it's the Java chops part that I think I'll fall down lol
    I've also asked on a java forum if anyone with experience of using Flex in Conjunction with Java can create the function that I'm after but my topic has been ignored like the ugly girl at the prom.
    I've never heard of a socket server. Would they be required to be installed on each machine that the interface is installed on?
    I'll definitely look into it. Thanks a lot mate.

  • Adobe Air download - "Couldn't write the application to the hard disk. Please verify the hard disk is available and try again" message. Been at this for days. Tried every suggested solution on multiple forums. Anyone come across a reliable fix?

    I have a subscription to Adobe Story Plus. I have been attempting to download the desktop version for over a week with no luck. I've read every forum I can find and attempted every suggested solution with no luck.
    Things I have done:
    - downloaded adobe air directly from website.
    - refreshed adobe story after air download and retried story download.
    - restarted computer
    - attempted download on multiple internet browsers.
    ***One thing that I have noticed is that I cannot actually find the adobe air application on my pc. The installer is present and every time I try to open it I am told that air is already installed and updated.
    Any help would be greatly appreciated. I'm no computer expert, but I am capable enough to usually troubleshoot my own problems. This one has gotten away from me though and I'm out of ideas.
    Thank you in advance.
    Adam

    Does these steps help?
    - Download Adobe AIR from https://get.adobe.com/air
    - Double click on the downloaded file and install it.
    - After installation, download the Adobe Story installer directory from https://story.adobe.com/AIR/AdobeStory.air
    - Double click on the downloaded installer to install it.

  • Adobe AIR for Video Wall project - the right tool?

    I need to decide whether Adobe AIR is the right tool for a Video Wall project. The Video wall would be one of only 4 installations.
    It would need good offline capability.
    The application would play back both canned video as well as twitter feeds.
    The other option is to go all HTML with perhaps the Canvas element to display video, graphics.
    I'm biased towards using Flash, AIR but am open to new ideas.
    What are the pros, cons of each approach?

    Pros of the Adobe route would be a little more control and reliability. You can easily go fullscreen, preload other videos easily in the background and display them on the hardware GPU decoded StageVideo (with the right video card, almost all of them at this point). Twitter feed loading would have some robust error handling to assure it goes smoothly but if you need offline capability you'll need some canned material for the feeds in that situation.
    HTML can go fullscreen but the caveat would be drawing your twitter feed over the video at that point. Because it's fullscreen I don't believe you can have your text over it from a <video> element but you'd need to use <canvas>'s fullscreen and actually mux the text into the video.
    The long haul of Adobe's roadmap clearly states video and games are the future of FP and AIR. I've done tons of kiosks in Flash and AIR, many of which just act as a video wall, attracting people to very large screens. I've had nothing but success doing this. I'd only even approach HTML5 if you have some reason to desire to put this on the web, and even then, Flash is still fine in that situation too.

  • ADOBE FORM for SAP - where is the documentation

    Hello Everybody,
    I started to work with adobe form for two weeks now.
    And i am wondering something since two days where is the documentation ?
    On adobe forums, we find a quick FAQ.
    On SCN there is some documentation.
    But where is the official or/and most complete documentation ?
    Is the full documentation given when you buy the adobe product or is there a full on line documentation ?
    Best Regards
    Abdou

    Here is documentation for formcalc
    http://help.adobe.com/en_US/livecycle/es/FormCalc.pdf
    Here is documentation for Scripting (JS)
    http://help.adobe.com/en_US/livecycle/es/lcdesigner_scripting_reference.pdf
    Here is the documentation on the whole package
    http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=000403.html
    Here is some additional practice to know how to use LiveCycle
    http://www.youtube.com/channel/UC6E8WlISDmgiyyq5ZWk-nVw

  • TweetDeck/Adobe Air not opening URLs in the browser in x86_64 system.

    Hi,
    I have managed to setup the last version of the (Adobe Air based) TweetDeck application running in my x86_64 and KDE system. I've gone through all the comments in the AUR entry and installed all the relevant lib32 libraries and such, and it appears to all work fine except for one issue.
    When I click on a URL contained in a tweet, nothing happens. It does not open the URL in Firefox as I would expect. Clicking on other items such as the user's ID or the posting date also do nothing. (I should mention that I have i686 ArchLinux running on another machine, and it handles all this with TweetDeck/Air no problems.) Now I suspect this is an Adobe Air issue rather than TweetDeck specific, but that is only my suspicion.
    I tried running strace on the app, and I can see that at one point it reads the Firefox profiles.ini and the prefs.js for my profile, so I suspect it is trying to do some sort of silly-buggers instead of just launching the /usr/bin/firefox executable with the URL as an argument.
    Any ideas on how I can get this working?
    Thanks.
    E.
    Last edited by ecognito (2012-02-06 04:19:04)

    Hi ecognito,
    what window manager are you using? I had a similar issue with pidgin not opening links in XFCE4 and was able to fix it... but I suspect yours MAY be a different case.

  • Adobe AIR HTML / Ajax Developement and Android

    Just confirming...  I haven't been developing in Flash since the days of Actionscript 2.0.  I've been mostly doing HTML / Ajax dev the past couple of years.  I started playing around with developing apps using HTML and Ajax.  I read in another thread that for Android dev, you have to use flash.  Is this true?  If so, is there any plans to open this up more?  I realize there might be some things that might not translate over, such as the touch interface, but I would really love to create some applications without having to get back into flash or learning Flash Builder. 

    Joe is correct on the support for HTML & AJAX. If you want to leverage those skills, you are going to have to stick with just using the on device web browser (which should be fairly robust) or look at alternate solutions like PhoneGap or Titanium's Appcelerator.
    Chris

  • Adobe air windows/C++:Error #3500: The extension context does not have a method with the name

    I created a C++ dynamic dll called by air.
    If the dll depends on other dlls, then the error#3500 occured. However removed other dlls, it works.
    Could that mean the air can only call one dynamic dll that doesn't depend any other dlls?
    does anybody met this problem before, or let me know what can I do?

    Alex Rekish wrote:
    Why you comment Windows-x86 in your extension.xml ?
    I think that is a problem. You launch your application on Windows but ANE haven't got Windows-x86 implementation (also you don't include it while packaging). So your application use default implementation. But default implementation don't use any native code and cannot use ExtensionContext. And you got error.
    If you don't need Windows-x86 native implementation than you need implement default implementation that different than Android-ARM. You don't need to use ExtensionContext in default implementation.
    Thanks for you answer Alex Rekish, Sorry I didn't screen shoot all about the extension.xml. I comment it because the latest ANE that I build is contain Android-ARM and default. so I commented. but I already try it using just ANE that's just contain Android-ARM, with Android-ARM and windows-x86,and Android-ARM, and default, and Android-ARM,default,Windows-x86 the error still the same.
    here the screen shoot, I embeded the ane that's i contain Windows-x86
    in action script test.as I didn't change it anythings, I just play it on extension.xml to build the ane. is there any mistake over there? I interact with your answer that "If you don't need Windows-x86 native implementation than you need implement default implementation that different than Android-ARM. You don't need to use ExtensionContext in default implementation." I didn't need to user ExtensionContext? is means? in the actionscript? or in extension.xml? can you explained

Maybe you are looking for

  • Is there a log for logins?

    I want to establish multiple accounts on one computer and want to find out if as an admin I can keep track of who's been on the computer and for how long? Is this possible with panther and/or tiger? Thanks.

  • Error while saving the maintenance order??

    Dear Experts, I am creating maintenance order for order type:PM01 and I given all parameters when I am saving the order I am getting some error called " Field reported by must be filled". Can u please tell me how to save this order. Thanks & Regards,

  • 2008 macbook pro is running very slow.

    Even simple things like trying to change a font in excel cause the spinning wheel to display before the font selection becomes visible. Any suggestions to resolve this?  I have over 40gb of storage available and 4gb of memory.

  • IDisk Sync Errors

    Since installing Snow Leopard, I have two types of iDisk Sync Errors: 1) It says a file was modified on Mobile Me and also modified on My Computer. This is simply untrue. I never use Mobile Me. 2) It says the file cannot be synced because it is "in u

  • No Add-ons

    I recently re-installed FireFox 7 but now when I go to Tools>>>Add-Ons nothing comes up. I cannot even find any add-ons to add. I even went to Google and tried to get to the add-on page that way, but I cannot access anything having to do with FF Add-