Hi,
I'm presenting my story and want the final page to print out - but just one paragraph! e.g. not any links to other passages.
I'm using harlowe and have had no problem installing a link to print the page, but haven't found a code that allows me to print just a section.
Anyone got any suggestions?
Thanks
Comments
You did not give an example of the method you are using to print the current page, so I am going to assume you are using the Javascript window.print() function, which can be used to print the current document.
How the window.print() works is determined by either the web-browser or the operating system you use, but it is meant to print out all of the current document. You can get around this by temporarily placing the content you want printed into an iframe element.
The following solution consists of two parts:
1. The Javascript which temporarily copies a marked section of text into a hidden iframe element which is then passed to the web-browser's Print system. The following code needs to be placed within your Story Javascript area, it adds a printSection function to your story:
2. The Passage code/markup used to indicate what section should be printed and the hidden iframe to use to print the section:
The example uses a section element with an id of results to mark the text to be included in the printout, it uses a hyperlink to call the printSection function and it contains a hidden iframe element which will be used by the printSection function: