PDFTron mac实现
问题描述:
我正在实施显示和编辑pdf的iOS和Mac应用程序。PDFTron mac实现
- 使用下面提供的代码完成iOS版本的实现。
- 问题是mac版本,它不包含显示和编辑pdf所需的PTPDFViewCtrl和ToolManager类。
任何人有任何经验使用他们的等效类的mac实现或建议mac实现?
#pragma mark - PDFKit
-(void)initialConfig {
#warning MISSING PDFTRon license key
// initialize PDFNet
[PTPDFNet Initialize:@""];
PTPDFViewCtrl *ctrl = [PTPDFViewCtrl new];
CGFloat offset = 20;
ctrl.frame = CGRectMake(0, offset, self.view.frame.size.width, self.view.frame.size.height - offset);
[ctrl SetBackgroundColor:0 g:0 b:0 a:0];
[ctrl SetHighlightFields:YES];
self.view.backgroundColor = [UIColor lightGrayColor];
[self.view addSubview:ctrl];
// open the PDF document included in the bundle in the PTPDFViewCtrl
PTPDFDoc *doc = [[PTPDFDoc alloc]initWithFilepath:self.viewModel.getFilePath];
[ctrl SetDoc:doc];
self.viewModel.doc = doc;
[ctrl setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth];
// add the toolmanager (used to implement text selection, annotation editing, etc.
ToolManager *toolManager = [[ToolManager alloc] initWithPDFViewCtrl:ctrl];
[toolManager changeTool:[PanTool self]];
ctrl.toolDelegate = toolManager;
}
非常感谢您的任何帮助。 Matti
答
为了演示的目的,我们的PDFNetCMac C/C++下载中包含了一个Java SWING示例项目,但不支持此示例。它使用PDFView类,并展示了一些集成的基础知识。例如,示例不支持注释。
同样,还有一个C++ Windows MFC示例,一些客户用它作为与跨平台框架(如Qt)集成的指南。
另一种选择是使用PDF WebViewer,它需要将用户界面移动到本地macOS应用程序的浏览器元素中,但WebViewer包含完整的查看体验,包括表单填充和注释。