福昕SDK for Android 从 5.1 版本开始支持打印 PDF 文档的功能。您可以在 Complete PDF viewer demo 的 More Menu View 菜单中点击 Wireless Print 按钮来打印 PDF 文档。此外,您可以调用以下 API 来打印 PDF 文档:
// for iPhone and iTouch
public void startPrintJob(Context context, PDFDoc doc, String printJobName, String outputFileName,IPrintResultCallback callback)
使用 PDF 打印功能的示例代码:
// Assume you have already Initialized a UIExtensionsManager object
PDFDoc doc = null;
IPrintResultCallback print_callback = new IPrintResultCallback() {
@Override
public void printFinished() {
}
@Override
public void printFailed() {
}
@Override
public void printCancelled() {
}
};
try {
doc = new PDFDoc("/mnt/sdcard/input_files/Sample.pdf");
doc.load(null);
} catch (PDFException e) {
Assert.fail("unexpect a PDF Exception!!errCode = " + e.getLastError());
}
uiExtensionsManager.startPrintJob(getActivity(), doc, "print with name", "print_withAPI", print_callback);
}