PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com
_____________________________________________________________

I have an Acrobat 5.0 Windows plug-in used for an internal Document Management System. 
When a DMS image is first stored, the plug-in executes the following code to password 
protect it:

        PDPerms perms = pdPermAll;
        PDDocSetNewCryptHandler(pddoc, ASAtomFromString("Standard"));
        StdSecurityData secData = (StdSecurityData)PDDocNewSecurityData(pddoc);
        if (!secData)
          E_RTRN_VOID

        secData->size = sizeof(StdSecurityDataRec);

        // Delete the following permissions from the image
        perms -= pdPermEdit;                    // No editing.
        perms -= pdPermCopy;                    // No copying to clipboard (allow?).
        perms -= pdPrivPermAccessible;          // ?? Seems to be needed.
        perms -= pdPrivPermDocAssembly;         // No adding or deleting pages
        secData->perms = perms;

        strcpy(secData->userPW, "");
        secData->hasUserPW = false; 
        secData->newUserPW = false; 
        strcpy(secData->ownerPW, myClientDataPtr.PASSWORD);
        secData->hasOwnerPW = true; 
        secData->newOwnerPW = true; 
        // The keylength is not documented. Search PDExpt.h for more info.
        // Basically, if 4 or less, means use Acrobat 3.x/4.x; if 5 or more, use 5.x 
security.
        // A length of 8 shows up as "custom length." 16 shows as 5.x standard.
        secData->keyLength = 16;

        PDDocSetNewSecurityData(pddoc, secData);

When a plug-in user opens one of these images, the following code reinstates the 
permissions:

        PDDocAuthorize(curDoc, pdPermAll, (void *)myClientData->PASSWORD);

This works in Acrobat 5.0 (except for bookmarks, but that's another issue). However, 
I've run a test in Acrobat 6.0 Standard, and the image comes up locked. But to unlock 
it, all I have to do is select Document -> Security -> Restrict Opening and Editing, 
and then make the dialog go away. I don't make any changes in the dialog, and not only 
can I close the dialog by pressing OK, but even if I select Cancel or X out of the 
dialog, the image still be becomes editable afterwards. Leonard Rosenthol of PDFSages 
seems to think this might be a bug, so I've submitted an official bug report to Adobe. 
However, the bug submission response page says that Adobe won't get back to me on 
that, so I'd like to see what others may think. Is this indeed a bug, or is there 
something here I need to change for 6.0?

Thanks,
Dick

*******************************
Richard J. (Dick) Vohlers
SAS Institute, Cary, NC
[EMAIL PROTECTED]
(919) 531-1127
*******************************


To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfdev.html

Reply via email to