I've been reviewing the material and documentation on the site and this tool looks really promising but wanted to confirm one thing. I want to use this to convert HTML/CSS files in batch mode to PDF. The problem with the HTML files that I have now is that it requires user interaction to change the margins settings for printing and also to eliminate the header and footer that are set by default by IE (The only way I've figured out how to do this programmatically is with an activex add-in). Seems like converting these documents to PDF would be the ultimate solution. It looks like I can set this using Prince XML - is this correct? Can you provide a link or quick sample of what I would need to put in the CSS file to do this? So far my efforts haven't proved successful. Thank you!
Forum › How do I...?
Print Margins
Page margins can be specified using @page rules, like this:
or:
@page { margin: 5mm }
or:
@page {
margin-left: 5mm;
margin-right: 5mm;
margin-top: 10mm;
margin-bottom: 10mm
}
Thanks - this fixed the margin problem - I had added this code but put it under the style heading so it didn't recognize it. Once I moved it outside, it worked great. One more question. I'm getting an error message in the output log that says "failure to parse all css rules" and the fonts and margins settings aren't being applied. Is there a way to further debug what the issue could be? Here is a sample of some of my CSS code:
.col1 {font-family="Arial";
font-size:11pt;
color:black;
width: 2.25in;
margin-left: 0in;
text-align:left;}
Thanks again for all your help!
.col1 {font-family="Arial";
font-size:11pt;
color:black;
width: 2.25in;
margin-left: 0in;
text-align:left;}
Thanks again for all your help!
font-family="Arial";
is unrecognized try
font-family:arial, helvetica, sans-serif;
Jim Albright
Wycliffe Bible Translators
Thanks - the font looks better but the formatting is still off.
1. Is there a way to tell which statements the program couldn't parse - it says "failed to parse all rules". I thought if I knew which specific statements, this might help me debug the issue.
2. I have a statement like this in my CSS code:
.col1 {font-family:arial, helvetica, sans-serif;
font-size:11pt;
color:black;
width: 2.25in;
margin-left: 0in;
text-align:left;}
and reference in my html like this:
<SPAN CLASS="col1"><B>One Product</B></SPAN>
but it doesn't appear to recognize the column settings for the class col1 so everything comes up jumbled in the PDF even though it looks fine in the html (as long as I manually set the margins and headers and footers)
Bill
1. Is there a way to tell which statements the program couldn't parse - it says "failed to parse all rules". I thought if I knew which specific statements, this might help me debug the issue.
2. I have a statement like this in my CSS code:
.col1 {font-family:arial, helvetica, sans-serif;
font-size:11pt;
color:black;
width: 2.25in;
margin-left: 0in;
text-align:left;}
and reference in my html like this:
<SPAN CLASS="col1"><B>One Product</B></SPAN>
but it doesn't appear to recognize the column settings for the class col1 so everything comes up jumbled in the PDF even though it looks fine in the html (as long as I manually set the margins and headers and footers)
Bill
Divide and conquer is one way to go. Keep a backup of your file. Toss out half of your CSS (you can just comment them out with
/* commented out stuff
*/
See when you have working output.
By process of elimination you can find the bad one.
Also I like adding
color:red;
color:green;
color:blue;
so I can definitely see what IS working
Be sure to look in the prince-log file.
/* commented out stuff
*/
See when you have working output.
By process of elimination you can find the bad one.
Also I like adding
color:red;
color:green;
color:blue;
so I can definitely see what IS working
Be sure to look in the prince-log file.
Jim Albright
Wycliffe Bible Translators
Thanks - didn't want to try the divide and conquer method if there was already a debug tool that I didn't know about. I've read a bit more in the forum about the SPAN tag and from what I read there is limited support for this? Is this still correct? If so, then maybe this product won't work for me
![:(](/forum/static/smiley/sadface.png)
<p class="yyyy"> I use <span class="xxx"> p and span </span>
almost exclusively </p>
You reference them using selectors in the CSS.
.yyyy selects all class yyyy
.xxx selects all class xxx
almost exclusively </p>
You reference them using selectors in the CSS.
.yyyy selects all class yyyy
.xxx selects all class xxx
Jim Albright
Wycliffe Bible Translators
Look for missing ";" I add one even to the last item where it is not required ... just in case I add something and forget to back up and add the required ";"
Also make sure that { and } match.
I use oXygen and it helps some, especially on match, but it doesn't understand Prince extensions. At least I don't know how to tell it to understand them.
Also make sure that { and } match.
I use oXygen and it helps some, especially on match, but it doesn't understand Prince extensions. At least I don't know how to tell it to understand them.
Jim Albright
Wycliffe Bible Translators
Sorry for the uninformative error messages, we hope to fix this in a future release of Prince. In the meantime, why not try the W3C CSS validator, which can help pinpoint CSS errors.
I don't think that the software supports the SPAN tag and that is what I am trying to confirm. I created a very simple html page -
<HTML>
<BODY>
<LINK REL="stylesheet" TYPE="text/css" HREF="c:\mycss.css">
<SPAN CLASS="col1"><B>Column 1</B></SPAN>
<SPAN CLASS="col2"><B>Column 2</B></SPAN><BR>
<SPAN CLASS="col1">57.70%</SPAN>
<SPAN CLASS="col2">65.63%</SPAN><BR>
</BODY>
</HTML>
and a very simple CSS page to go with it -
@page {
margin-left: .25in;
margin-right: .25in;
margin-top: .25in;
margin-bottom: .25in
}
<STYLE>
<!--
.col1 {font-family:arial, helvetica, sans-serif;
font-size:11pt;
color:black;
width: 2.25in;
margin-left: 0in;
text-align:left;}
.col2 {font-family:arial, helvetica, sans-serif;
font-size:11pt;
color:black;
text-align:right;
margin-left: 0.5in;
width: 1.0in;}
-->
</STYLE>
This comes up fine in my browser but in the PDF version I create, it doesn't seem to recognize the width settings or text alignment.
Thanks!
<HTML>
<BODY>
<LINK REL="stylesheet" TYPE="text/css" HREF="c:\mycss.css">
<SPAN CLASS="col1"><B>Column 1</B></SPAN>
<SPAN CLASS="col2"><B>Column 2</B></SPAN><BR>
<SPAN CLASS="col1">57.70%</SPAN>
<SPAN CLASS="col2">65.63%</SPAN><BR>
</BODY>
</HTML>
and a very simple CSS page to go with it -
@page {
margin-left: .25in;
margin-right: .25in;
margin-top: .25in;
margin-bottom: .25in
}
<STYLE>
<!--
.col1 {font-family:arial, helvetica, sans-serif;
font-size:11pt;
color:black;
width: 2.25in;
margin-left: 0in;
text-align:left;}
.col2 {font-family:arial, helvetica, sans-serif;
font-size:11pt;
color:black;
text-align:right;
margin-left: 0.5in;
width: 1.0in;}
-->
</STYLE>
This comes up fine in my browser but in the PDF version I create, it doesn't seem to recognize the width settings or text alignment.
Thanks!
Your browser knows how wide your screen is.
You have not specified how wide your paper is for the PDF.
try
@page {
marks: crop cross ;
size: 5in 8in portrait;
font: 10pt Gentium, Georgia, serif;
line-height: 13;
}
You have not specified how wide your paper is for the PDF.
try
@page {
marks: crop cross ;
size: 5in 8in portrait;
font: 10pt Gentium, Georgia, serif;
line-height: 13;
}
Jim Albright
Wycliffe Bible Translators
Thanks for the advice - I specified the exact size of the page but it still doesn't seem to be recognizing the SPAN command -in particular the width and text alignment settings. I'm guessing that the SPAN command just isn't supported. Maybe in a future version?
SPAN is not a command. And yes it is supported. Something else is going on. Try running the samples ... like the magic of Prince.
Jim Albright
Wycliffe Bible Translators
Place the <link> element in the document <head>, not the <body>. Also, get rid of the <style></style> tag and <!-- comments --> in your external CSS file, they aren't necessary.