SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot loupblanc's Avatar
    Join Date
    Nov 2004
    Location
    Edinburgh
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    printing embedded document

    Hi folks,

    I was looking at various sources about the window.print() statement that I would like to try and use for my current project.

    My question is, is there a way to print a file other than the one currently displayed? For example, I have file2 in an <embed> (don't flame me for not using <object> I have my reasons) of file1 and I was wondering if there was a mean I could send file2 to the printer with a button in file1?

    I'm not terribly JavaScript savvy so if it's obvious, I'm sorry.

    Thanks for the help

    -Jean-Loup

  2. #2
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    you might be able to use something like this......
    Code:
    function printEmbed(id){
    document.write(document.getElementById(id).innerHTML+"<script type=\"text/javascript\">window.print()</script>")
    }
    don't know if it'll work. Let us know here how you get on.

    Good luck
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  3. #3
    SitePoint Zealot loupblanc's Avatar
    Join Date
    Nov 2004
    Location
    Edinburgh
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Mark but that didn't seem to work. Nothing gets sent to the spooler, that is.

    The embedded document is SVG by the way.

    Cheers

    -Jean-Loup


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •