IBM®
跳转到主要内容
    中国 [选择]    使用条款
 
 
Select a scope: Search for:    
    首页    产品    服务与解决方案     支持与下载    个性化服务    
跳转到主要内容

developerWorks 中国  >  XML  >

Using XSL-FO to create printable documents

Portable database reporting using XML revisited

developerWorks

Return to article


Listing 1. Describing the desired page layout for the FO processor
try {
   output.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
   output.write("<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\">\n");
   output.write("  <fo:layout-master-set>\n");
   output.write("    <fo:simple-page-master master-name=\"sample\" \n");
   output.write("             page-height=\"" + pageHeight + "mm\"\n");
   output.write("             page-width=\"" + pageWidth + "mm\"\n");
   output.write("             margin-left=\"25mm\"\n");
   output.write("             margin-right=\"25mm\"\n");
   output.write("             margin-top=\"" + headerHeight + "mm\"\n");
   output.write("             margin-bottom=\"" + footerHeight + "mm\">\n");
   output.write("      <fo:region-body margin-top=\"0mm\"\n"); 
   output.write("             margin-bottom=\"0mm\" />\n"); 
   output.write("      <fo:region-before extent=\"3cm\" />\n"); 
   output.write("      <fo:region-after extent=\"1.5cm\" />\n"); 
   output.write("    </fo:simple-page-master>\n");
   output.write("  </fo:layout-master-set>\n");
   output.write("  <fo:page-sequence master-name=\"sample\">\n");
   output.write("    <fo:flow flow-name=\"xsl-region-body\">\n");
} catch ( java.io.IOException ioe ) {
   System.out.println("Error writing to output file.");
   System.exit( -1 );
}

Return to article.

    关于 IBM 隐私条约 联系 IBM 使用条款