OFD
OFD 文件,即开放金融文档 (Open Financial Document),用于存储和交换数字金融文档。它们是开放的并基于 XML,专门为金融文档如合同、发票和报表设计。
OFD 文件包含结构化数据和图形元素,定义文档的布局和内容,包括文本、图片、矢量图形、注释和其它相关信息。XML 格式便于理解、处理和渲染文档内容。
OFD 文件具有多种优势,包括保证文档的完整性、安全性和互操作性。它们可以进行数字签名以确保文档的真实性,并可以加密以保护敏感信息。此外,OFD 文件还支持如表单字段和数字签名等交互式功能。
要处理 OFD 文件,需要支持 OFD 标准的 OFD viewer 或编辑器软件。这些工具允许您显示、编辑、转换和打印 OFD 文档的内容。
总的来说,OFD 文件提供了一种标准化且高效的方法来数字化呈现金融文档,简化了金融信息的交换、存储和管理。
系统要求
平台: Windows, Linux (x64 and armv8)
开发语言: C, C++, Java, C#, Python, Node.js
License Key: license key 中包含 'OFD' 模块的权限
SDK 版本: Foxit PDF SDK 10.0 以上
OFD 引擎文件
请联系 Foxit 支持团队或销售团队获取 OFD 的引擎文件包。获取包后,将其解压到所需的目录。比如,Windows 解压到 "D:/ofd/win",Linux x64 解压到 "ofd/linux64",Linux arm64 解压到 "ofd/linuxarm64"。
如何运行 ofd demo
在运行 \examples\simple_demo\ofd
文件夹下的 ofd demo 之前,您需要首先在 demo 代码中添加 ofd 引擎文件路径,例如:
// "engine\_path" is the path of ofd engine file. Please refer to Developer Guide for more details.
String engine\_path = "D:/ofd/win/x64"; // For Windows x64
然后,按照其他 demo 的步骤运行该 demo。
如何实现 OFD 文件与 PDF 文件之间的转换
import com.foxit.sdk.common.Library;
import com.foxit.sdk.addon.conversion.OFDConvertParam;
import com.foxit.sdk.addon.conversion.Convert;
...
// Initialize OFD engine.
Library.initializeOFDEngine(engine\_path);
static String src\_ofd\_path = input\_path + "wm\_txttiled.ofd";
static String src\_pdf\_path = input\_path + "test.pdf";
// Convert PDF document to OFD document, and convert OFD document to PDF document.
{
OFDConvertParam convert\_param = new OFDConvertParam(false);
// Convert OFD document to PDF document.
Convert.fromOFD(src\_ofd\_path, "", output\_path + "ofd2pdf.pdf", convert\_param);
// Convert PDF document to OFD document.
Convert.toOFD(src\_pdf\_path, "", output\_path + "pdf2ofd.ofd", convert\_param);
}
// Release OFD engine.
Library.releaseOFDEngine();
如何渲染 OFD 文档页面
import com.foxit.sdk.common.Image;
import com.foxit.sdk.common.Library;
import com.foxit.sdk.common.Bitmap;
import com.foxit.sdk.addon.ofd.\*;
import com.foxit.sdk.common.Progressive;
import com.foxit.sdk.common.fxcrt.Matrix2D;
import com.foxit.sdk.common.fxcrt.RectI;
...
// Initialize OFD engine.
Library.initializeOFDEngine(engine\_path);
// Render OFD document to bitmap.
{
String render\_file\_path = input\_path + "content\_flag.ofd";
OFDDoc doc = new OFDDoc(render\_file\_path, "");
OFDPage ofd\_page = doc.getPage(0);
// Get the size of the page.
float w = ofd\_page.getWidth();
float h = ofd\_page.getHeight();
Bitmap bitmap = new Bitmap((int)w, (int)h, Bitmap.e\_DIBArgb, null, 0);
RectI fRect = new RectI(0, (int)h, (int)w, 0);
bitmap.fillRect(0xFFFFFFFF, fRect);
// Get the display matrix of the page.
Matrix2D matrix\_1 = ofd\_page.getDisplayMatrix(0, 0, (int)w, (int)h, e\_Rotation0);
OFDRenderer ofd\_render = new OFDRenderer(bitmap);
Progressive progressive = ofd\_render.startRender(ofd\_page, matrix\_1);
String sSaveFilePath = output\_path + "renderBitmap.bmp";
// Add the bitmap to image and save the image.
Image image = new Image();
image.addFrame(bitmap);
image.saveAs(sSaveFilePath);
ofd\_page.release();
doc.release();
}
// Release OFD engine.
Library.releaseOFDEngine();