i have a problem printing an html page. Actually the structure i have is the following:
i have a html page cointaining several iframes. Each one of these iframes embeds an html page. What i need to do is to add inside the fraim “Main” a print link letting the user to print the iframe content.
I added inside the html of that specific iframe the following:
<a href="javascript:window.print()"><img src="./custom/images/print.png" /></a>
but i’m having several problems.
1) The main one is that the text inside this page is scrollable cause is dynamic and can be really long, so usually never fit the screen and the user needs to scroll to see the whole text. Right now, when i try to print the page what is printed is only the content of the iframe where i put the link (this is what i want even if is unexpected cause i never specify it) and only the visible part of the text, instead i want it all as a whole document. Also the scrollable bars are printed and i don’t know why. Is there something i need to add to print it all?
2) I have another not correct behaviour with safari that i don’t have with Chrome. Basically when i click the print button on Chrome a new layer is opened by the browser where a preview of the page is displayed loading the “print” css i created (this is really cool and is probably a Chrome feature). Instead with safari the preview is loaded directly inside the iframe, so what the content displayed to the user changes and usually it gets stuck on it. Do you know why i get this issue? For me is ok to not show any print preview, i just want the content in page not to be modified.
P.S. About point one i need to directly print the page, i cannot open a new window with a printable version if the page and then print the new one. This cause my page is dinamically generated with external “tool” api so let’s say i don’t have it out of this context.
I could have but i need to ask someone to create an API to do that and i could do it only if i was 100% sure this would fix the problem.
Thanks to everybody.
Honestly keep it simple!
Have a link to a printable version under the ifram! So say you have your Iframe code
This is a really comin work around which dosn’t look bad and most users will generally accept because its scene alot!
Naturally page2.php in the iframe tag is just a representation,
Im sure there is another way about it aswell but to me this would be the most simplistic!