简体   繁体   中英

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. 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. 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. These methods can be found inside adobe javascript reference as well as 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. 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:

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

Also the SOAP object was deprecated beginning with Acrobat 8.0. Use Net.SOAP instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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