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, Sean - Tracker, Chris - Tracker Supp, 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 » Wed Jun 01, 2016 12:35 pm

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4325
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Find out if document is protected for modification

Post by Sasha - Tracker Dev Team » Thu Jun 02, 2016 11:15 am

Hello Tom,

The correct method to use is this:
http://sdkhelp.tracker-software.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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
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 » Fri Jun 10, 2016 2:00 pm

OK thx!

User avatar
Sasha - Tracker Dev Team
User
Posts: 4325
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Find out if document is protected for modification

Post by Sasha - Tracker Dev Team » Fri Jun 10, 2016 2:04 pm

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
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 » Wed Jun 29, 2016 7:32 am

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

http://sdkhelp.tracker-software.com/vie ... equestOper

User avatar
Sasha - Tracker Dev Team
User
Posts: 4325
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Find out if document is protected for modification

Post by Sasha - Tracker Dev Team » Wed Jun 29, 2016 7:47 am

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
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply