print with HTML or .pdf??

G

Guest

I want to make some of my website content available for printing. After
reviewing the posts, printing from HTML pages looks tricky (i.e., margins,
page break control, etc.). I'm starting to think life will be easier for
myself and my viewers if I just create .pdf files that can be downloaded &
printed.
The downside of the .pdf approach is that I would have to effectively
duplicate my content - once in HTML and once in .pdf. It's a waste of
server space. This is relevant because some of these pages have a lot of
..jpgs. If it were just text I would not care.

So, if I just create simple, single column FrontPage tables of the
appropriate width for 80 characters, and load in my text and image links, can
I reasonably hope of a consistent layout across platforms?
Any hope at all of creating hard page breaks in the document?
Would a frontpage table allow a page break within a row? Or could I assume a
row would always break to the next page if it could not fit?
Thanks!!!
 
W

Wes

Just create a button. Example:
<input type="button" value="Print This Page"
onclick="window.print()"style="font-family: Tahoma; color: #000000;
font-weight: bold">
 
G

Guest

Hi Ted,

Try the following. It is designed to print only the content between the
<div> tags.

Print Ready Page Script

<Head> Script
-----------------------------------------
<!-- Script Courtesy of http://About.com -->
<script language="JavaScript">
var gAutoPrint = true; // Tells whether to automatically

call the print function

function printSpecial()
{
if (document.getElementById != null)
{
var html = '<HTML>\n<HEAD>\n';

if (document.

getElementsByTagName != null)
{
var headTags =

document.getElementsByTagName("head");
if (headTags.length > 0)
html +=

headTags[0].innerHTML;
}

html += '\n</HE>\n[an error

occurred while processing this directive]\n';

var printReadyElem = document.

getElementById("printReady");

if (printReadyElem != null)
{
html +=

printReadyElem.innerHTML;
}
else
{
alert("Could not find the

printReady function");
return;
}

html += '\n</BO>\n</HT>';

var printWin = window.open("","

printSpecial");
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint)
printWin.print();
}
else
{
alert("The print ready feature is

only available if you are using an browser. Please

update your browswer.");
}
}

</script>
-----------------------------------------


-----------------------------------------
<Body> Script

You will suround the portion you want
to print with the following tags.

<div id="printReady"> <!-- THIS GOES
BEFORE THE PRINTABLE PORTION -->


</div> <!-- THIS GOES AFTER THE
PRINTABLE PORTION Script courtesy
http://about.com -->
 
S

Stefan B Rusynko

Probably a lot easier to just use css to not print portions of the page (in IE)

In head section
<style type="text/css" media="print">.noprint { display: none;} </style>

Then in page
<div class="noprint">
<p>You will surround the portion you want DO NOT WANT to print with the style class tags</p>
</div>


--




| Hi Ted,
|
| Try the following. It is designed to print only the content between the
| <div> tags.
|
| Print Ready Page Script
|
| <Head> Script
| -----------------------------------------
| <!-- Script Courtesy of http://About.com -->
| <script language="JavaScript">
| var gAutoPrint = true; // Tells whether to automatically
|
| call the print function
|
| function printSpecial()
| {
| if (document.getElementById != null)
| {
| var html = '<HTML>\n<HEAD>\n';
|
| if (document.
|
| getElementsByTagName != null)
| {
| var headTags =
|
| document.getElementsByTagName("head");
| if (headTags.length > 0)
| html +=
|
| headTags[0].innerHTML;
| }
|
| html += '\n</HE>\n[an error
|
| occurred while processing this directive]\n';
|
| var printReadyElem = document.
|
| getElementById("printReady");
|
| if (printReadyElem != null)
| {
| html +=
|
| printReadyElem.innerHTML;
| }
| else
| {
| alert("Could not find the
|
| printReady function");
| return;
| }
|
| html += '\n</BO>\n</HT>';
|
| var printWin = window.open("","
|
| printSpecial");
| printWin.document.open();
| printWin.document.write(html);
| printWin.document.close();
| if (gAutoPrint)
| printWin.print();
| }
| else
| {
| alert("The print ready feature is
|
| only available if you are using an browser. Please
|
| update your browswer.");
| }
| }
|
| </script>
| -----------------------------------------
|
|
| -----------------------------------------
| <Body> Script
|
| You will suround the portion you want
| to print with the following tags.
|
| <div id="printReady"> <!-- THIS GOES
| BEFORE THE PRINTABLE PORTION -->
|
|
| </div> <!-- THIS GOES AFTER THE
| PRINTABLE PORTION Script courtesy
| http://about.com -->
| -----------------------------------------
|
| Please when using free code, keep
| the author and source information
| intact in the script. Thanks.
|
|
|
| "Ted Perkins" wrote:
|
| > I want to make some of my website content available for printing. After
| > reviewing the posts, printing from HTML pages looks tricky (i.e., margins,
| > page break control, etc.). I'm starting to think life will be easier for
| > myself and my viewers if I just create .pdf files that can be downloaded &
| > printed.
| > The downside of the .pdf approach is that I would have to effectively
| > duplicate my content - once in HTML and once in .pdf. It's a waste of
| > server space. This is relevant because some of these pages have a lot of
| > .jpgs. If it were just text I would not care.
| >
| > So, if I just create simple, single column FrontPage tables of the
| > appropriate width for 80 characters, and load in my text and image links, can
| > I reasonably hope of a consistent layout across platforms?
| > Any hope at all of creating hard page breaks in the document?
| > Would a frontpage table allow a page break within a row? Or could I assume a
| > row would always break to the next page if it could not fit?
| > Thanks!!!
| > --
| > Ted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top