Search Unity

Printing? (i.e. to a printer?)

Discussion in 'Scripting' started by purplexis, Jul 23, 2007.

  1. purplexis

    purplexis

    Joined:
    Jan 29, 2006
    Posts:
    71
    Hey, I'm working in a project where we need to be able to screengrab and print the result from within the executable. Does Unity support printing intrinsically? Do I need to use Unity to call the OS to bring up some print dialog?

    I honestly have never tried anything like this before, and don't know where to start. Any help would be much appreciated.

    Thanks!
     
  2. DaveyJJ

    DaveyJJ

    Joined:
    Mar 24, 2005
    Posts:
    1,558
    Well, in my web designs I simply wrap an image or text link with this to cause either a Mac or PC system to print the page (using the styles I've defined in a print-specific CSS file) ...

    Code (csharp):
    1.  
    2. [url="#"]text link or graphic here[/url]
    3.  
    So the Javascript function "window.print()" is what you need, but I don't know if that's supported in Unity.
     
  3. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    Printing from the web player doesn't work -- you just get blankness, unfortunately. I bug reported it a while ago.

    You're pretty out of luck with regards to printing from a standalone, too. It'd be hard. Your best bet would be to have your app capture a screenshot and have that screenshot opened in some program that supports printing.

    -Jon