How to encrypt a PDF file from C# or ASP.NET or VB.NET Web application?

Hi There,

We currently use your encryptPDF dll for our windows based products and it works great.

We would like to know if you have a similar product for web based applications.

Specifically we need a 64 bit app that is based on .NET framework 4.5 or later.

We have tried using the trial com version on your web site but we get a compatibility issue when trying to hook it up to our web based applications, as follows:

image

Thanks.
Customer
-------------------------------------------------------------------------
Yes, we have a "PDF Editor Toolkit Professional SDK" product, it contains PDF encryption function, you may download the trial version of "PDF Editor Toolkit Professional SDK" product from this web page to try,

https://www.verypdf.com/app/pdf-editor-toolkit/try-and-buy.html#pro
https://www.verypdf.com/pdfsdk/pdf_editor_toolkit_pro_trial.zip

Please by following steps to encrypt a PDF file from Web application,

1. Please download and unzip pdf_editor_toolkit_pro_trial.zip package first,

2. Please run "Install-pdfshell.exe-Com.vbs" to install pdfshell.exe into your system,

3. Go to "VBS_examples" folder, run "encryptpdf.vbs" file, you will get two PDF files, one PDF file contains stampers and another PDF file is encrypted by passwords,

The following is the sample source code of "encryptpdf.vbs" file,

--------------------------------------------
Dim pdfObject
dim FileID
dim bresult
dim FilePath
dim sFileName, dFileName
on error resume Next
   
Set fso = CreateObject("Scripting.FileSystemObject")
strFolder = fso.GetParentFolderName(wscript.ScriptFullName)
FilePath = strFolder & "\"
   
Set pdfObject = CreateObject("pdfshell2.shellexe")

Dim szPDFFile
Dim id
Dim code
Dim lFile  
 
Very_Set_Opacity = 240

szPDFFile = FilePath & "stamppdf2.pdf"
 
on error resume Next

pdfObject.com_VerySetLicenseKey "XXXXXXXXXXXXXXXXX"
 
id = pdfObject.com_VeryStampOpen(szPDFFile,FilePath &  "_001.pdf")
If (id > 0) Then
     
      iRet = pdfObject.com_VerySetFunction(id, Very_Set_Opacity, 30, 0, 0, 0)
      code = pdfObject.com_VeryStampAddText(id, 1, "Opacity_30", 65296, 0, 0, 0, -45, 0, 0, 0, "", 48, 0, "", 0)
      iRet = pdfObject.com_VerySetFunction(id, Very_Set_Opacity, 60, 0, 0, 0)
      code = pdfObject.com_VeryStampAddText(id, 3, "Opacity_60", 65296, 0, 0, 0, 45, 0, 0, 0, "", 48, 0, "", 0)
      iRet = pdfObject.com_VerySetFunction(id, Very_Set_Opacity, 90, 0, 0, 0)
      code = pdfObject.com_VeryStampAddText(id, 5, "Opacity_90", 65296, 0, 0, 0, -45, 0, 0, 0, "", 48, 0, "", 0)
      iRet = pdfObject.com_VerySetFunction(id, Very_Set_Opacity, 10, 0, 0, 0)
      code = pdfObject.com_VeryStampAddText(id, 7, "Opacity_10", 65296, 0, 0, 0, 45, 0, 0, 0, "", 48, 0, "", 0)

      pdfObject.com_VeryStampClose (id)
      
  End If

  pdfObject.VeryRepairPDF("_001.pdf", "_001_repaired.pdf")
 
  bresult = pdfObject.com_veryEncryptPDF(szPDFFile, FilePath & "TestEncrypt_out.pdf",128,4,"user","owner")
 
  if Err.number=0 then
          MsgBox "All Functions execute success!"
  else
          MsgBox "Have errs when execute functions!"
  end if
--------------------------------------------

4. You can call "pdfshell2.shellexe" from C# code to stamp and encrypt PDF files also.

5. When you try to call "pdfshell2.shellexe" from C# source code or other web applications, you may encounter a permission restriction problem, if so, you need give "Full Control Permission" to "Everyone" to "pdfshell2.shellexe" DCOM, if you don't know how to do, please refer to following web pages,

http://www.verydoc.com/doc-to-any-faq.html

http://www.verydoc.com/blog/verydoc-release-notes-verydoc-releases-an-exe-com-of-verypdfcomruncmd-exe-today-verypdf-exe-com-does-allow-you-to-call-ms-office-and-any-exe-application-from-asp-php-c-net-etc-program-languag.html

If you encounter any problem, please feel free to let us know, we will assist you asap.

Some more information for your reference,

https://www.verypdf.com/wordpress/201603/how-to-call-pdf-editor-toolkit-professional-sdk-from-64bit-application-42383.html

https://www.verypdf.com/wordpress/201109/i-can-not-get-verysplitmergepdf-function-to-work-2532.html

https://www.verypdf.com/wordpress/201609/how-to-convert-a-pcx-file-to-pdf-file-using-pdf-editor-toolkit-pro-sdk-43035.html

VeryPDF

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!