wxPdfDocument SetProtection

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
CarCan
In need of some credit
In need of some credit
Posts: 8
Joined: Mon Jun 24, 2019 8:10 am

wxPdfDocument SetProtection

Post by CarCan »

I would like to know, why

Code: Select all

void
wxPdfDocument::SetProtection(int permissions,
                             const wxString& userPassword,
                             const wxString& ownerPassword,
                             wxPdfEncryptionMethod encryptionMethod,
                             int keyLength)
..............
	int allowedFlags = wxPDF_PERMISSION_PRINT | wxPDF_PERMISSION_MODIFY |
                       wxPDF_PERMISSION_COPY  | wxPDF_PERMISSION_ANNOT;
..............               
only some permission flags are allowed.
Thanks.
utelle
Moderator
Moderator
Posts: 1126
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxPdfDocument SetProtection

Post by utelle »

CarCan wrote: Tue Dec 19, 2023 4:46 pm I would like to know, why only some permission flags are allowed.
Well, actually there is no specific reason. The method for setting access permissions was implemented already in the early days of this project based on an existing FPDF extension (which had those restrictions). Up to now no one complained about missing permission flags, and IMHO the currently "allowed" flags cover most relevant use cases.

Currently 4 flags are not explicitly supported:
  • wxPDF_PERMISSION_FILLFORM - Allow filling forms (mostly covered by wxPDF_PERMISSION_ANNOT)
  • wxPDF_PERMISSION_EXTRACT - Allow extract text and/or graphics (no longer supported in latest PDF standard)
  • wxPDF_PERMISSION_ASSEMBLE - Allow assemble document (mostly covered by wxPDF_PERMISSION_MODIFY)
  • wxPDF_PERMISSION_HLPRINT - Allow high resolution print (mostly covered by wxPDF_PERMISSION_PRINT)
Please note that all these flags are enabled by default. So, only if you want to disable one of them you would need to be able to modify them.
CarCan
In need of some credit
In need of some credit
Posts: 8
Joined: Mon Jun 24, 2019 8:10 am

Re: wxPdfDocument SetProtection

Post by CarCan »

Thanks a lot for the answer.
Post Reply