sending html file to safari for printing

  • I've got an app I've written for myself, it's mac core data based.

    I need to be able to output a printout of some data, it would
    basically be a table with some images and data. I think the easiest
    thing to do may be to create an HTML page that can then be opened in
    Safari.

    I can manage creating and saving the HTML file, how do I automatically
    open it up in Safari (or the default browser it doesn't matter) so I
    can print it out?

    Many Thanks

    Amy Gibbs
    Willow Tree Crafts
    www.willowtreecrafts.co.uk
  • On Jun 6, 2012, at 9:08 AM, Amy Gibbs wrote:

    > I can manage creating and saving the HTML file, how do I automatically open it up in Safari (or the default browser it doesn't matter) so I can print it out?

    Tell NSWorkspace to open the file.

    —Jens
  • Le 6 juin 2012 à 18:08, Amy Gibbs a écrit :

    > I've got an app I've written for myself, it's mac core data based.
    >
    > I need to be able to output a printout of some data, it would basically be a table with some images and data. I think the easiest thing to do may be to create an HTML page that can then be opened in Safari.
    >
    > I can manage creating and saving the HTML file, how do I automatically open it up in Safari (or the default browser it doesn't matter) so I can print it out?

    Perhaps you have a reason to open it in a browser, but you can also directly print it from your application.

    In short, create the html code, instantiate a WebView, make it render your html code and pass the web view to a NSPrintOperation.

    Frédéric Testuz
previous month june 2012 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
Go to today