8 Replies Latest reply: Jun 18, 2008 6:38 PM by Andrew99
tahm77 Level 1 Level 1 (0 points)
Sorry if this is in the wrong category - didn't see a Safari support area.

I want to print only a selected area from the browser. This is simple right. But I have no option to print selection in the print dialogue. How do I do that?

imac, Mac OS X (10.5)
  • Steve M. Level 5 Level 5 (4,740 points)
    You might want to try using Grab which is in the Utilities folder in Applications. It will allow you to select a portion of the screen and then you can print the result.

    Regards,
    Steve M.
  • Carolyn Samit Level 10 Level 10 (95,950 points)
    HI Tom,

    Here's the link to the Safari forums: http://discussions.apple.com/category.jspa?categoryID=169
    It's not always easy to find these... don't sweat it. You don't need to repost there this time... keep that link for future use though.

    As for printing... this from the Safari Help Menu: To print a webpage:

    Choose File > Print.

    To specify the page size, orientation, or scaling, click the disclosure triangle next to the Printer pop-up menu to expand the Print dialog.

    To include the background image, open the pop-up menu below the Orientation section, and choose Safari.

    To include the web address and date, select “Print headers and footers.”

    I agree with Steve M. use Grab which is located in Applications/Utilities to define a selection to be printed. You may have to copy/paste into TextEdit first before you print.

    Carolyn

    Message was edited by: Carolyn Samit
  • Andrew99 Level 4 Level 4 (1,300 points)
    You might also consider using an AppleScript. Copy the block of code below and paste it into your AppleScript Script Editor:

    *tell application "System Events"*
    *keystroke tab using command down*
    *keystroke "c" using command down*
    *tell application "TextEdit" to activate*
    *tell process "TextEdit"*
    *keystroke "n" using command down*
    *keystroke "v" using command down*
    *keystroke "p" using command down*
    *end tell*
    *end tell*

    Save the script as File Format: application, and leave the Options unchecked. The saved script should be run either from the Dock or from the Scripts Menu.

    Simply use your mouse to highlight what you want to print and then press on the docked script icon, or select the saved script from the Scripts Menu.

    Note that the script requires that under System Preferences > Universal Access, "Enable access for assistive devices" is checked.

    Regards, Andrew99
  • tahm77 Level 1 Level 1 (0 points)
    Hi you guys, thanks for your help. I did use the Grab, that was good.
    I've also created the applescript, but right now it is printing the applescript itself. Without putting the script on the dock, how would I run it, eg, from within Safari?
  • tahm77 Level 1 Level 1 (0 points)
    By the way, is it useful to mark replies as "Helpful"? My connection is slow, so only want to do this if it's helpful to somebody.
    Thanks again,
    Tom
  • Malcolm Rayfield Level 7 Level 7 (28,070 points)
    You can add Print Selection to the Services menu in Safari (and other Cocoa applications).
    <http://osiris.laya.com>
  • Steve M. Level 5 Level 5 (4,740 points)
    Glad Grab helped!

    Regards,
    Steve M.
  • Andrew99 Level 4 Level 4 (1,300 points)
    tom djb,

    Without putting the script on the dock, how would I run it, eg, from within Safari?


    If the AppleScript is saved to your Home/Library/Scripts folder, it can be accessed through the Scripts Menu. The Scripts Menu would need to be enabled first using the AppleScript Utility, found within the AppleScript folder. Check "Show Script Menu in menu bar." You would subsequently notice a squiggly AppleScript icon appear on your menu bar. Clicking on it would allow you to select the script while working in Safari, or any other application for that matter.

    Another option would be to use a keyboard shortcut program such as Spark. Using Spark you can assign a key combo or a function key to open the saved AppleScript, so that after highlighting your selection you might need only press a single key to bring up the print dialog with your selection ready to print.

    ...but right now it is printing the applescript itself.


    This shouldn't happen as long as the following conditions are met:

    1) The script was saved as an application.

    2) The script application is being run from the Dock, Scripts Menu or by using a keyboard shortcut.

    3) You're not switching to the Finder or any other application in between the time you highlight your selection and the time you launch the script. A clue to the technical reason for this can be found in the second line of the script, "keystroke tab using command down." This command simulates what goes on under ordinary circumstances when you hold down your Command key and press Tab -- the Application Switcher palette appears, and does so with the +previous application used+ highlighted. The long and short of it is that the script needs to look at Safari as the previous application rather than the current one because the current application when running the AppleScript is going to be the script itself. Therefore, if for example, you were to highlight your selection and then switch to the Desktop to double-click on the saved AppleScript, the script would look at the Finder as the last application used, thus breaking the script and likely resulting in your printing the script icon instead of the selection you highlighted in Safari.

    Admittedly, the script can be intolerant unless certain conditions are met, and this intolerance does indeed serve to point out some of the limitations of GUI Scripting on the whole.

    Several good suggestions in this thread; Good luck with whichever you choose...

    Regards, Andrew99