Not allowing editing of PDF form documents (with fields)  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, 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.
jdknox
User
Posts: 17
Joined: Mon Aug 22, 2011 10:59 pm

Not allowing editing of PDF form documents (with fields)

Post by jdknox »

Is there an way to make the editor not allow updates on a pdf form document? If not, is there a way to use tracker to convert a pdf form document to read only so the user doesn't have the ability to type in field data or update checkboxes in the form? (we only want view only of this content) On a related topic, I was able to turn off the green "contains fields" bar at the top of the viewer using the support "Programatically hiding the "contains fields" banner?" post... viewtopic.php?f=66&t=28040
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: Not allowing editing of PDF form documents (with fields)  SOLVED

Post by Sasha - Tracker Dev Team »

Hello jdknox,

In the pdfCtl_OnEvent, you should listen to this event and break when it's an modify fields operation:

Code: Select all

if (e.nEventID == nIDS[(int)IDS.e_operBeforeExecute])
{
	PDFXEdit.IOperation oper = (PDFXEdit.IOperation)e.pFrom;
	int opModifyFields = pdfCtl.Inst.Str2ID("op.fields.modify", false);
	if (opModifyFields == oper.ID)
	{
		e.pEvent.Handled = true;
		e.pEvent.Result = 1;
	}
}
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jdknox
User
Posts: 17
Joined: Mon Aug 22, 2011 10:59 pm

Re: Not allowing editing of PDF form documents (with fields)

Post by jdknox »

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

Re: Not allowing editing of PDF form documents (with fields)

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ