输出预览 (Output Preview)
从版本 7.4 开始,Foxit PDF SDK 支持输出阅览功能,可以预览分色和测试不同的颜色配置文件。
系统需求
平台: Windows, Linux (x86 and x64), Mac (x64)
开发语言: C, C++, Java, C#, Python, Objective-C
License Key: 有效的 license key
SDK 版本: Foxit PDF SDK (C, C++, Java, C#, Objective-C) 7.4 或更高版本; Foxit PDF SDK (Python) 8.3 或更高版本
如何运行 output preview demo
在运行 \examples\simple_demo\output\_preview
文件夹下的 output preview demo 之前,您需要首先将变量 default\_icc\_folder\_path
设置为 SDK 包下 \res\icc\_profile
文件夹的路径。例如:
// "default\_icc\_folder\_path" is the path of the folder which contains default icc profile files. Please refer to Developer Guide for more details.
String default\_icc\_folder\_path = "E:/foxitpdfsdk\_X\_X\_win\_java/res/icc\_profile";
然后,按照其他 demo 运行的步骤运行该 demo。
如何使用 Foxit PDF SDK 进行输出预览
import com.foxit.sdk.common.Library;
import com.foxit.sdk.common.Renderer;
import com.foxit.sdk.common.fxcrt.Matrix2D;
import com.foxit.sdk.pdf.OutputPreview;
// Make sure that SDK has already been initialized successfully.
// Set folder path which contains default icc profile files.
Library.setDefaultICCProfilesPath(default\_icc\_folder\_path);
// Load a PDF document; Get a PDF page and parse it.
// Prepare a Renderer object and the matrix for rendering.
OutputPreview output\_preview = new OutputPreview(pdf\_doc);
String simulation\_icc\_file\_path = input\_path + "icc\_profile/USWebCoatedSWOP.icc";
output\_preview.setSimulationProfile(simulation\_icc\_file\_path);
output\_preview.setShowType(OutputPreview.e\_ShowAll);
ArrayList<String> process\_plates = output\_preview.getPlates(OutputPreview.e\_ColorantTypeProcess);
ArrayList<String> spot\_plates = output\_preview.getPlates(OutputPreview.e\_ColorantTypeSpot);
// Set check status of process plate to be true, if there's any process plate.
for (int i = 0; i < (int)process\_plates.size(); i++) {
output\_preview.setCheckStatus(process\_plates.get(i), true);
}
// Set check status of spot plate to be true, if there's any spot plate.
for (int i = 0; i < (int)spot\_plates.size(); i++) {
output\_preview.setCheckStatus(spot\_plates.get(i), true);
}
Bitmap preview\_bitmap = output\_preview.generatePreviewBitmap(pdf\_page, display\_matrix, renderer);