PDF转OFD的特点

把PDF格式文件转换为OFD格式文件。

 显示效果

示例代码所生成的OFD文件:下载

 示例代码

package test.create.c14;

import java.io.File;
import iofd.layout.OfdDocument;
import iofd.pdf.Pdf2OfdHelper;
import test.create.TestDocUtil;
import test.create.resource.TestFileResource;

public class C1401Helloworld {

	public static void main(String[] args) throws Throwable {
		C1401Helloworld o = new C1401Helloworld();
		o.done();
	}

	private void done() throws Throwable {
		String clzName = this.getClass().getSimpleName();
		System.out.println(clzName + " begin");
		String pdfFileName = "iOFD_cover.pdf";
		File file = new File(TestFileResource.class.getResource(pdfFileName).toURI());
		Pdf2OfdHelper helper = Pdf2OfdHelper.newInstance();
		
		try {
			OfdDocument doc = helper.create(file);
			String fileName = TestDocUtil.getOfdFilePath(this.getClass(), false);
			doc.save(fileName);
			System.out.println(clzName + " end");
		} finally {
			helper.close();
		}
	}
}