不同页面自定义纸张大小
示例代码
package test.create.c05;
import iofd.kernel.geom.PageSize;
import iofd.layout.DefaultPageProperty;
import iofd.layout.OfdDocument;
import iofd.layout.block.PageSeparator;
import iofd.layout.block.Paragraph;
import iofd.layout.block.paragraph.Text;
import iofd.layout.contants.PaperRotation;
import iofd.layout.physcial.PhyscialPage;
import test.create.TestDocUtil;
/**
*
* */
public class C0506PageDifferentSize {
public static void main(String[] args) throws Throwable {
C0506PageDifferentSize o = new C0506PageDifferentSize();
o.done();
}
private void done() throws Throwable {
String clzName = this.getClass().getSimpleName();
System.out.println(clzName + " begin");
OfdDocument doc = new OfdDocument();
DefaultPageProperty prop = DefaultPageProperty.createDefaultPageProperty();
prop.setDebug(true);
prop.setPageSize(PageSize.A3);
prop.setRotation(PaperRotation.HORIZONTAL);
doc.setDefaultPageProperty(prop);
Paragraph p = new Paragraph();
p.add(new Text("第一页设置为A3横向纸张,第二页设置为A4纵向纸张,这里是第一页"));
doc.add(p);
PageSeparator s = new PageSeparator();
PhyscialPage nextPage = new PhyscialPage(prop, PageSize.A4, PaperRotation.VERTICAL);
s.setNextPage(nextPage);
doc.add(s);
p = new Paragraph();
p.add(new Text("第一页设置为A3横向纸张,第二页设置为A4纵向纸张,这里是第二页"));
doc.add(p);
s = new PageSeparator();
doc.add(s);
p = new Paragraph();
p.add(new Text("第三页设置为默认的上一个页面使用的纸张,这里是第三页"));
doc.add(p);
String fileName = TestDocUtil.getOfdFilePath(this.getClass());
doc.save(fileName);
System.out.println(clzName + " end");
}
}