Encryption convert page in white pages

If you are a VB developer and have questions about using our products from VB, here is the place to post them.
Post Reply
imaRay
Posts: 5
Joined: Tue Apr 26 2005

Encryption convert page in white pages

Post by imaRay »

I have installed Amyuni PDF Converter 2.50b with my Developer License of the Amyuni PDF Converter Professional for Windows® NT/2000/XP.

In a VB application i have tried to crypt a document with the following lines of code:

Code: Select all

' set the permanent license key for the product
Declare Function SetLicenseKey Lib "CDIntf250" Alias "SetLicenseKeyA" (ByVal szCompany As String, ByVal szLicKey As String) As Long

' encrypt PDF document
Declare Function EncryptPDFDocument Lib "CDIntf250" (ByVal FileName As String, ByVal Owner As String, ByVal User As String, ByVal Permissions As Long) As Long
Declare Function EncryptPDFDocument128 Lib "CDIntf250" (ByVal FileName As String, ByVal Owner As String, ByVal User As String, ByVal Permissions As Long) As Long

Public Sub DllEcryption(...)

'******* Encrypt a pdf file after it is generated *****
    ' SetLicenseKey is needed with some advanced funtions like Encryption
    SetLicenseKey LicensedTo, ActivationCode

    If b128Bits Then
        ' EncryptPDFDocument128 can be used for 128 bits encryption.
        EncryptPDFDocument128 sPDFFileName, sOwner, sUser, -64 + 4
    Else
        ' Protect a document using 40-bits encryption, enable the user to print(4)
        EncryptPDFDocument sPDFFileName, sOwner, sUser, -64 + 4
    End If
End Sub
The result has been:
- a white document, if the original document were composed of one single page.
- the first page full and the other ones white, if the original document were composed more pages.

The result of EncryptPDF... function is 1.

While the PDF Generation running very well.

How is possible?

I thank in advance for whichever aid you can give to me.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

I will try to reproduce this and if I was able to reproduce it I will transmit it to our developers to check it.

Thanks.
imaRay
Posts: 5
Joined: Tue Apr 26 2005

Thanks Joan i give you...others details and tests.

Post by imaRay »

I tested the encryption during creation and work fine.

This is function:

First i have added declaration of UNDOCUMENTED functions (i see with "Dependency walker" directly from cdintf250.dll ):

Code: Select all

Declare Function SetOwnerPassword Lib "CDIntf250" (ByVal hPrinter As Long, ByVal szValue As String) As Long
Declare Function SetUserPassword Lib "CDIntf250" (ByVal hPrinter As Long, ByVal szValue As String) As Long
Declare Function SetPermissions Lib "CDIntf250" (ByVal hPrinter As Long, ByVal nPermissions As Long) As Long
Second i put EncryptDocument in the options:

Code: Select all

Public Sub DllPrintReportEncrypted(ByVal sPDFOutputFileName As String, _
                                   ByVal sOwner As String, _
                                   ByVal sUser As String)
    
    Dim bOk As Boolean
    Dim nResult As Long
    
    ' Setting the file name options to NoPrompt and UseFileName
    ' To give the generated pdf file a specific name
    nResult = SetFileNameOptions(m_PDFDll, NoPrompt + UseFileName + EncryptDocument)
    
    nResult = SetOwnerPassword(m_PDFDll, sOwner)
    nResult = SetUserPassword(m_PDFDll, sUser)

    nResult = SetPermissions(m_PDFDll, -60 + 4)
    
    ' Set the output pdf file name
    nResult = SetDefaultFileName(m_PDFDll, sPDFOutputFileName)
        
    ' Enable the printer before each printout for the Developer version
    nResult = EnablePrinter(m_PDFDll, LicensedTo, ActivationCode)
    
    ' Print  report
    RaiseEvent AmyPrintReport(PrintReport, bOk)
                       
    ' When Printing ends reset fileNameOptions to 0
    SetFileNameOptions m_PDFDll, 0
    
End Sub
I hope that this detail is useful in order to analyze in depth the problem.
imaRay
Posts: 5
Joined: Tue Apr 26 2005

Re: Thanks Joan i give you...others details and tests.

Post by imaRay »

imaRay wrote: I tested the encryption during creation and work fine.

Code: Select all


    nResult = SetPermissions(m_PDFDll, -64 + 4)
    
imaRay
Posts: 5
Joined: Tue Apr 26 2005

Post by imaRay »

With respect to:
I tested the encryption during creation and work fine.

I must be corrected on the crypting during the PDF creation, i have made of the tests and:
The crypted documents are not white, but the security flags are wrong.
This is the result:

Code: Select all

Notes:                                  None            Printing        Doc.            Copying Text    Adding and Changing
X = Allowed                                                             Modification	and Graphics	notes

Crypt method                            40      128     40      128     40      128     40      128     40      128
Flag -64 +                              0               4               8               16              32	

Can by opened by: Acrobat XX or later   3.0     5.0     3.0     5.0     3.0     5.0     3.0     5.0     3.0     5.0
Printing                                X                       X       X
Changing the document                                                           X       X			
Document Assembly                               X               X               X	    X       X               X
Content Copying or Extraction                                                                   X       X	
Content Extraction for Accessibility            X               X               X               X       X       X
Commenting                              X                                                                       X
Filling of form fields                  X       X               X               X       X       X               X
Signing                                 X       X               X               X       X       X               X
Creation of Template Pages                      X               X               X       X       X               X
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

This is happening in the DLL interface only in version 2.50a, using the ActiveX interface encrypting a pdf document is working properly.

This issue is fixed and a new version including the fix will be online in the next couple of days.

Have a nice day.
imaRay
Posts: 5
Joined: Tue Apr 26 2005

Post by imaRay »

Unfortunately my test application currently is in VB for comfort, but the final application will be in C++ and will have obligatorily to use the DLL.
Therefore they are obliged to wait for the new release of the correct DLL.

It's possible to know a indicative day of the possible new release?

Thanks for the aid.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

I don't have a specific date for the release but this should be in the next couple of weeks.

Thanks.
Post Reply