on 05-03-2007 10:20 PM
Hello, I am very recent to the whole world of web dynpro and have encountered my first problem. I need to print the content of an iframe in a view, I searched through many of the forums with no concrete answer. I found a solution posted by Sigiswald Madou on September 2006 which consisted of using a button to summon a method that prints the screen using javascript code. It works... problem is, it only prints what the user is viewing on the screen (i.e. the content of the whole page) and what i need is for the content of the iframe to be printed only... does anyone have a clue of how to get this done??
PS I know this subject has been discussed in the past, but i could not find a solid solution in the forums...
Thanks in advance...
If button is in the same IFrame as content, then call window print()
If they are in different IFram-es then call either window.parent.frames[0].print() or window.parent.frames[1].print() depending what iframe goes first (content or button correspondingly)
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If there is another way not involving javascript please be kind enough to point me out, since i am running out of time and options...
10 points will be awarded for helpful answers of course...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pablo,
Unfortunately there's no nice solution in NW04. NW04s does support printing the content of an <b>iView</b> in the portal. Using javascript isn't a very elegant option and not exactly recommended either. The way I implemented it by using a Web Dynpro <b>IFrame</b> UI element will likely break in the future since as of NW04s the <b>IFrame</b> UI element is deprecated.
What exactly are you trying to do? Print the content of the (Web Dynpro) <b>iView</b> or the content of a Web Dynpro <b>IFrame</b> UI element (the iView is also rendered as an iframe in HTML)? Not that it makes that much difference. Personally using <i>javascript:parent.parent.focus(); print();</i> worked for me. Note the <i>parent.parent</i> and the <i>focus()</i>, this may depend on your particular situation. Maybe you need <i>parent</i> or <i>parent.parent.parent</i>? Or maybe a variant on what Valery mentioned, e.g. <i>javascript:parent.frames[0].focus(); parent.frames[0].print();</i>? The truth is out there...
Kind regards,
Sigiswald
Hi Sigiswald, thank you for answering.
What I am trying to do is print an entire i view which has an iframe with an html page as its source (actually what is important here is that i print the iframe, not so much the entire iview). The view's layout is organized as follows:
1 - the default root element container (transparent container)
1.1 - a group container
1.1.1 - a series of UI elements inside the group (labels, texts, etc.)
1.1 - at the same level as the group container (not inside of it) is the iframe which contains the html page which i am trying to print (the html page is about 3 letter size print pages long) and other elements such as a link to action (which triggers the print action).
Those are my four levels in my layout.The problem is, the content of the iframe appears on screen but it does not print. The weird thing is, when I print it, it prints out the whole iview (and everything on it) and it leaves the space of the iframe blank... all 3 pages of it... weird if you ask me, it's as if the browser was detecting the page but deciding not to print it.
Now, I used the same solution in 3 other apps with the same requirements and characteristics, the layouts are organized in the exact same way as I described before, and they work fine... they print out exactly what i want them to print, but only one of them does not. I have tried every piece of javascript code, such as window.print(), window.parent.print(), window.parent.focus.print(), self.print(), window.parent.frames[1 and 0].print and so on... the results are the same.
Any thoughts??
Regards...
By the way, I was told that using parent.frames["frame name"].print(); would work, but i keep getting an error message that the resource does not exist (i.e. the iframe). I suspect it's because the iFrame in NWDS does not have the "name" property, it only has the "id" property, which i am using instead of name... Does anyone know how I can identify an iframe in this case?
THANKS in advance...
I tried the window.parent.frames[0].print(); and window.parent.frames[1].print(); and indeed it prints out only the outline of the iFrame (without the portal menu which is what I need) but it does not print the content of the iFrame itself!! Any idea as to what is happening??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.