【发布时间】:2021-04-09 13:17:44
【问题描述】:
我的公司使用来自 square9 的名为 GlobalCapture 的软件。它基本上用于 OCR 扫描和制作工作流程。他们有一套 API 和一个 SDK 来做各种事情。他们有一个选项可以在您的工作流程中创建您自己的自定义节点。
我正在尝试使用 C#(他们的大部分示例代码是在他们的 GitHub 上用 C# 编写的)来创建一个自定义节点,该节点接受 PDF 并将其转换为 JPG(我正在尝试解决的另一个问题)弄清楚)但是,我花了几个小时查看他们的文档,试图用它创建一个程序。
我不是要求任何人直接解决我的问题。或多或少,我真的需要有人帮我指出正确的方向,并告诉我需要学习什么才能使这一切顺利进行。
这些是我正在使用的文档和信息:
https://github.com/Square9Softworks/custom-workflow-nodes(C#自定义节点示例代码)
http://knowledge.square-9.com:8090/display/CN/Custom+Nodes
http://knowledge.square-9.com:8090/display/CN/Square9.CustomNode+SDK
到目前为止,这是我的代码:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Square9.CustomNode;
using System.Threading.Tasks;
using Syncfusion.Pdf.Parsing;
using Syncfusion.Windows.Forms.PdfViewer;
using System.Drawing;
using System.Drawing.Imaging;
namespace ConvertDocument
{
public class Convert : CaptureNode
{
public override void Run()
{
var pagePath = Process.Document.GetPage(0);
Process.Document.AddPage(pagePath);
LogHistory("Custom Node Test");
/*
PdfViewerControl pdfViewer = new PdfViewerControl();
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(pagePath);
pdfViewer.Load(loadedDocument);
Bitmap image = pdfViewer.ExportAsImage(0);
*/
}
}
}
注释掉的代码假设使用名为syncfusion的库将PDF转换为JPG。我的 Run() 函数中的三行是我试图查看是否可以将文本添加到历史记录选项卡并将页面添加到正在浏览的文档中。
但是,我在他们的 web 应用程序中的 square9 上不断收到此错误: “CaptureNode 类内部抛出异常:方法或操作未实现。”
我需要学习什么才能让这一切顺利进行?我还是 C# 的新手,但是我真的很想弄乱这个 SDK。我只是很困惑去哪里。
【问题讨论】:
-
您需要确定代码的哪一行导致了错误。在 Run() 方法的第一行设置断点并单步执行代码。检查每个变量的值并确保它有效。例如,可能 Process.Document.GetPage(0) 返回 null,当您将其传递给 Process.Document.AddPage() 方法时会导致错误。
-
谢谢,会做的