space-before.optimum="5pt"
space-after.optimum="3pt"
text-align="start">
- Here are 3 fo:leader with the property rule and no text
+ Here are some fo:leader with the property rule and different rule styles
+ (solid, dashed, dotted, double, groove, ridge the last one with colored backgrounds
+ to the effect)
</fo:block>
<!-- Inserts a leader (rule). Because leader is an inline fo you have
to wrap it into a block element -->
- <fo:block text-align="start"
+ <fo:block text-align="center"
space-before.optimum="12pt"
space-after.optimum="12pt">
<fo:leader leader-pattern="rule"
- rule-thickness="3.0pt"
+ rule-thickness="1pt"
leader-length="6cm"/>
</fo:block>
- <!-- Inserts a leader (rule). Because leader is an inline fo you have
- to wrap it into a block element -->
<fo:block text-align="center"
space-before.optimum="12pt"
space-after.optimum="12pt">
+
<fo:leader leader-pattern="rule"
- rule-thickness="3.0pt"
- leader-length="6cm"/>
+ leader-length="6cm"
+ rule-thickness="1pt"
+ rule-style="dashed"/>
</fo:block>
- <!-- Inserts a leader (rule). Because leader is an inline fo you have
- to wrap it into a block element -->
- <fo:block text-align="end"
+
+ <fo:block text-align="center"
space-before.optimum="12pt"
space-after.optimum="12pt">
<fo:leader leader-pattern="rule"
- rule-thickness="3.0pt"
- leader-length="6cm"/>
+ leader-length="6cm"
+ rule-style="dotted"
+ rule-thickness="1pt"/>
+ </fo:block>
+
+ <fo:block text-align="center"
+ space-before.optimum="12pt"
+ space-after.optimum="12pt">
+ <fo:leader leader-pattern="rule"
+ leader-length="6cm"
+ rule-thickness="2pt"
+ rule-style="double"/>
+ </fo:block>
+
+ <fo:block text-align="center" background-color="silver"
+ space-before.optimum="12pt"
+ space-after.optimum="12pt">
+ <fo:leader leader-pattern="rule"
+ leader-length="6cm"
+ rule-thickness="1pt"
+ rule-style="groove"
+ color="black" />
+ </fo:block>
+
+ <fo:block text-align="center" background-color="silver"
+ space-before.optimum="12pt"
+ space-after.optimum="12pt">
+ <fo:leader leader-pattern="rule"
+ leader-length="6cm"
+ rule-thickness="1pt"
+ rule-style="ridge"
+ color="black" />
</fo:block>
<!-- Normal text -->
}
/**
- * set the PDF document's producer
- *
- * @param producer string indicating application producing PDF
- */
+ * set the PDF document's producer
+ *
+ * @param producer string indicating application producing PDF
+ */
public void setProducer(String producer) {
this.pdfDoc.setProducer(producer);
}
/**
- * render the areas into PDF
- *
- * @param areaTree the laid-out area tree
- * @param writer the PrintWriter to write the PDF with
- */
+ * render the areas into PDF
+ *
+ * @param areaTree the laid-out area tree
+ * @param writer the PrintWriter to write the PDF with
+ */
public void render(AreaTree areaTree,
PrintWriter writer) throws IOException, FOPException {
MessageHandler.logln("rendering areas to PDF");
this.pdfDoc.output(writer);
}
+ /**
+ * add a line to the current stream
+ *
+ * @param x1 the start x location in millipoints
+ * @param y1 the start y location in millipoints
+ * @param x2 the end x location in millipoints
+ * @param y2 the end y location in millipoints
+ * @param th the thickness in millipoints
+ * @param r the red component
+ * @param g the green component
+ * @param b the blue component
+ */
+ protected void addLine(int x1, int y1, int x2, int y2, int th,
+ PDFPathPaint stroke) {
+ currentStream.add("ET\nq\n" + stroke.getColorSpaceOut(false) +
+ (x1 / 1000f) + " "+ (y1 / 1000f) + " m " +
+ (x2 / 1000f) + " "+ (y2 / 1000f) + " l " +
+ (th / 1000f) + " w S\n" + "Q\nBT\n");
+ }
+
/**
* add a line to the current stream
*
* @param x2 the end x location in millipoints
* @param y2 the end y location in millipoints
* @param th the thickness in millipoints
+ * @param rs the rule style as String containing dashArray + dashPhase
* @param r the red component
* @param g the green component
* @param b the blue component
*/
protected void addLine(int x1, int y1, int x2, int y2, int th,
- PDFPathPaint stroke) {
+ String rs, PDFPathPaint stroke) {
currentStream.add("ET\nq\n" + stroke.getColorSpaceOut(false) +
- (x1 / 1000f) + " "+ (y1 / 1000f) + " m " +
+ rs + (x1 / 1000f) + " "+ (y1 / 1000f) + " m " +
(x2 / 1000f) + " "+ (y2 / 1000f) + " l " +
(th / 1000f) + " w S\n" + "Q\nBT\n");
}
/**
- * add a rectangle to the current stream
- *
- * @param x the x position of left edge in millipoints
- * @param y the y position of top edge in millipoints
- * @param w the width in millipoints
- * @param h the height in millipoints
- * @param stroke the stroke color/gradient
- */
+ * add a rectangle to the current stream
+ *
+ * @param x the x position of left edge in millipoints
+ * @param y the y position of top edge in millipoints
+ * @param w the width in millipoints
+ * @param h the height in millipoints
+ * @param stroke the stroke color/gradient
+ */
protected void addRect(int x, int y, int w, int h,
PDFPathPaint stroke) {
currentStream.add("ET\nq\n" + stroke.getColorSpaceOut(false) +
}
/**
- * add a filled rectangle to the current stream
- *
- * @param x the x position of left edge in millipoints
- * @param y the y position of top edge in millipoints
- * @param w the width in millipoints
- * @param h the height in millipoints
- * @param fill the fill color/gradient
- * @param stroke the stroke color/gradient
- */
+ * add a filled rectangle to the current stream
+ *
+ * @param x the x position of left edge in millipoints
+ * @param y the y position of top edge in millipoints
+ * @param w the width in millipoints
+ * @param h the height in millipoints
+ * @param fill the fill color/gradient
+ * @param stroke the stroke color/gradient
+ */
protected void addRect(int x, int y, int w, int h,
PDFPathPaint stroke, PDFPathPaint fill) {
currentStream.add("ET\nq\n" + fill.getColorSpaceOut(true) +
}
/**
- * render area container to PDF
- *
- * @param area the area container to render
- */
+ * render area container to PDF
+ *
+ * @param area the area container to render
+ */
public void renderAreaContainer(AreaContainer area) {
int saveY = this.currentYPosition;
/**
- * render block area to PDF
- *
- * @param area the block area to render
- */
+ * render block area to PDF
+ *
+ * @param area the block area to render
+ */
public void renderBlockArea(BlockArea area) {
doFrame(area);
Enumeration e = area.getChildren().elements();
}
/**
- * render display space to PDF
- *
- * @param space the display space to render
- */
+ * render display space to PDF
+ *
+ * @param space the display space to render
+ */
public void renderDisplaySpace(DisplaySpace space) {
int d = space.getSize();
this.currentYPosition -= d;
}
/**
- * render image area to PDF
- *
- * @param area the image area to render
- */
+ * render image area to PDF
+ *
+ * @param area the image area to render
+ */
public void renderImageArea(ImageArea area) {
// adapted from contribution by BoBoGi
int x = this.currentAreaContainerXPosition + area.getXOffset();
}
/**
- * render SVG area to PDF
- *
- * @param area the SVG area to render
- */
+ * render SVG area to PDF
+ *
+ * @param area the SVG area to render
+ */
public void renderSVGArea(SVGArea area) {
int x = this.currentXPosition;
int y = this.currentYPosition;
}
/**
- * render inline area to PDF
- *
- * @param area inline area to render
- */
+ * render inline area to PDF
+ *
+ * @param area inline area to render
+ */
public void renderInlineArea(InlineArea area) {
char ch;
StringBuffer pdf = new StringBuffer();
}
/**
- * render inline space to PDF
- *
- * @param space space to render
- */
+ * render inline space to PDF
+ *
+ * @param space space to render
+ */
public void renderInlineSpace(InlineSpace space) {
this.currentXPosition += space.getSize();
}
/**
- * render line area to PDF
- *
- * @param area area to render
- */
+ * render line area to PDF
+ *
+ * @param area area to render
+ */
public void renderLineArea(LineArea area) {
int rx = this.currentAreaContainerXPosition + area.getStartIndent();
int ry = this.currentYPosition;
}
/**
- * render page into PDF
- *
- * @param page page to render
- */
+ * render page into PDF
+ *
+ * @param page page to render
+ */
public void renderPage(Page page) {
AreaContainer body, before, after;
}
/**
- * render leader area into PDF
- *
- * @param area area to render
- */
+ * render leader area into PDF
+ *
+ * @param area area to render
+ */
public void renderLeaderArea(LeaderArea area) {
int rx = this.currentXPosition;
;
int th = area.getRuleThickness();
int st = area.getRuleStyle();
String rs = setRuleStylePattern(st);
- //checks whether thickness is = 0, because of bug in pdf (or where?),
+ //checks whether thickness is = 0, because of bug in pdf (or where?),
//a line with thickness 0 is still displayed
if (th != 0) {
switch (st) {
}
/**
- * set up the font info
- *
- * @param fontInfo font info to set up
- */
+ * set up the font info
+ *
+ * @param fontInfo font info to set up
+ */
public void setupFontInfo(FontInfo fontInfo) {
FontSetup.setup(fontInfo);
FontSetup.addToResources(this.pdfDoc, fontInfo);
}
/**
- * defines a string containing dashArray and dashPhase for the rule style
- */
+ * defines a string containing dashArray and dashPhase for the rule style
+ */
private String setRuleStylePattern (int style) {
String rs = "";
switch (style) {