You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by doballve <di...@digital-artefacts.fi> on 2008/06/25 14:57:30 UTC
Re: Apache FOP: Trimbox, Bleedbox, Crop marks
I was looking for PDF TrimBox and FOP and found your thread. Excellent to see
this is getting implemented. What's the schedule for this feature? Any
progress so far?
BTW, I have patched the old 0.20.5 to support PDF TrimBox like this:
- accept "-trimboxPadding=##mm" param from command line
- check for "trimboxPadding" in Configuration
- generate TrimBox per page: [ (tp) (tp) (width - tp), (height - tp) ]
Very crudely, this is the important part in PDFPage.toPDF(), after
"/MediaBox":
//DA Custom: TrimBox
try {
String trimboxPaddingSt =
Configuration.getStringValue("trimboxPadding", Configuration.PDF);
if (trimboxPaddingSt != null && !"".equals(trimboxPaddingSt)) {
if (trimboxPaddingSt.endsWith("mm")) {
float trimboxPaddingFloat =
Float.parseFloat(trimboxPaddingSt.substring(0, trimboxPaddingSt.length() -
2));
long trimboxPadding = Math.round(trimboxPaddingFloat *
2.83464567);
sb.append("/TrimBox [ " + trimboxPadding + " " +
trimboxPadding + " " + (this.pagewidth - trimboxPadding) + " " +
(this.pageheight - trimboxPadding) + " ]\n");
} else {
throw new Exception("Invalid trimboxPadding. Value must
be given in mm (##.##mm)");
}
}
} catch (Exception e) {
e.printStackTrace();
}
for the crop marks, I'm drawing them as borders to fo:block-container with
position="absolute", so handling it in the XSL level, before FOP. It works,
but I had to play around with all page sizes and margins...
--
View this message in context: http://www.nabble.com/Apache-FOP%3A-Trimbox%2C-Bleedbox%2C-Crop-marks-tp16445615p18111796.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org