Find out if document is protected for modification

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
Tom Princen
User
Posts: 83
Joined: Wed Mar 25, 2015 10:15 am

Find out if document is protected for modification

Post by Tom Princen »

How do i know what is allowed with the PDF?

I found out these 2 functions but they are not documented on the site

GetSecurityData
and
GetSecurityHandler
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Find out if document is protected for modification

Post by Sasha - Tracker Dev Team »

Hello Tom,

The correct method to use is this:
https://sdkhelp.pdf-xchange.com/vie ... Permission
And here's the code sample that would hopefully be enough for your cause:

Code: Select all

private void checkDocumentSecurityToolStripMenuItem_Click(object sender, EventArgs e)
{
	PDFXEdit.PXC_PermStatus ps = pdfCtl.Doc.CoreDoc.RequestPermission(PDFXEdit.PXC_RequestObj.Perm_ObjDoc, PDFXEdit.PXC_RequestOper.Perm_OperModify, System.IntPtr.Zero);
	if (ps == PDFXEdit.PXC_PermStatus.Perm_ReqGranted)
		MessageBox.Show("Granted");
	else
		MessageBox.Show("Denied");
}
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Tom Princen
User
Posts: 83
Joined: Wed Mar 25, 2015 10:15 am

Re: Find out if document is protected for modification

Post by Tom Princen »

OK thx!
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Find out if document is protected for modification

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Tom Princen
User
Posts: 83
Joined: Wed Mar 25, 2015 10:15 am

Re: Find out if document is protected for modification

Post by Tom Princen »

whats the PXC_RequestOper constant for requesting the page extraction right?
once again the documentation not complete...

https://sdkhelp.pdf-xchange.com/vie ... equestOper
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Find out if document is protected for modification

Post by Sasha - Tracker Dev Team »

Hello Tom,

Well many enumeration values' names are self explanatory in many cases. Also these are taken for the PDF documentation. In this case the Perm_OperExport should be used as you are using the export pages feature (judging from your description). If you are using the Copy Pages feature then the Perm_OperCopy should be used. If you are moving pages then the Perm_OperDelete should be also checked as you are removing them from their original position in the document.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply