简体   繁体   English

使用 adobe 将注释保存到 SQL 服务器数据库 javascript

[英]Save annotations into SQL Server database using adobe javascript

I am having problems trying to save (insert) a .pdf with annotations into a SQL Server database.我在尝试将带有注释的.pdf保存(插入)到 SQL 服务器数据库时遇到问题。 The database is located inside Visual Studio and I am currently using adobe javascript to save it, but I run into security settings prevent access to this property or method when i clicked the button inside the pdf.该数据库位于 Visual Studio 内,我目前正在使用 adobe javascript 来保存它,但是当我单击 pdf 内的按钮时,我遇到了安全设置阻止访问此属性或方法。 I'm using a pdf button field from spire.pdf to try to save into the db and pass the script into pdf javascript action. I'm using a pdf button field from spire.pdf to try to save into the db and pass the script into pdf javascript action.

So far, i have tried using trusted privilege function, using adbc connection and odbc connection as well as the soap method but it doesn't work and I'm quite lost at what to do or continue next.到目前为止,我已经尝试使用受信任的特权 function,使用 adbc 连接和 odbc 连接以及 soap 方法,但它不会在接下来的工作中丢失或继续。 These methods can be found inside adobe javascript reference as well as api.这些方法可以在 adobe javascript 参考以及 api 中找到。

PdfPageBase page = pdf.Pages[i];

PdfButtonField button = new PdfButtonField(page, "Save");
button.Bounds = new RectangleF(420, 10, 100, 40);
button.BorderColor = new PdfRGBColor(Color.AliceBlue);
button.BorderStyle = PdfBorderStyle.Solid;
button.ForeColor = new PdfRGBColor(Color.White);
button.Text = "Save";
button.BackColor = new PdfRGBColor(Color.Blue);
button.ToolTip = "Save";
button.Font = new PdfFont(PdfFontFamily.Helvetica, 9f);

pdf.Form.Fields.Add(button);

String script = "var nButton=app.alert({"
                + "    cMsg: \"Do you want to save this paper into the database?\","
                + "    nIcon: 2,"
                + "    nType : 2,"
                + "    cTitle: \"Confirm Save?\""
                + "});"
                + "if ( nButton == 4 ) {var myProxy = SOAP.connect(\"http://localhost:57103/test123.svc?wsdl) \"); var testString = (\"This is a test string\"); var result = (myProxy.echoString(testString)); console.println(\"Result is :  + result\")};";

PdfJavaScriptAction confirm = new PdfJavaScriptAction(script);
button.Actions.GotFocus = confirm;

The expected result i should get is to be able to save the pdf with annotations into the SQL Server database inside Visual Studio and being able to retrieve it with the annotations.我应该得到的预期结果是能够将带有注释的 pdf 保存到 Visual Studio 内的 SQL 服务器数据库中,并能够使用注释检索它。 However, the actual result showed the security settings prevent access to this property or method and i cannot proceed to continue.但是,实际结果显示安全设置阻止访问此属性或方法,我无法继续。

Would really appreciate some help, thank you: :)非常感谢您的帮助,谢谢::)

ADBC in Acrobat JavaScript is has been off by default since Acrobat 9. To activate ADBC, create a registry key of type DWORD with the name “bJSEnable” and a value of “true” (1) in the following location: Acrobat JavaScript 中的 ADBC 自 Acrobat 9 以来默认已关闭。要激活 ADBC,请在以下位置创建一个名为“bJSEnable”且值为“true”(1) 的 DWORD 类型的注册表项:

HKEY_CURRENT_USER\SOFTWARE\Adobe\Adobe Acrobat\VERSION\ADBC HKEY_CURRENT_USER\SOFTWARE\Adobe\Adobe Acrobat\VERSION\ADBC

Also the SOAP object was deprecated beginning with Acrobat 8.0.此外,从 Acrobat 8.0 开始,不推荐使用 SOAP object。 Use Net.SOAP instead.请改用 Net.SOAP。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM