This is a migrated thread and some comments may be shown as answers.

Disable editing PDF after processing

1 Answer 331 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Jimmy
Top achievements
Rank 1
Iron
Veteran
Jimmy asked on 20 Feb 2020, 08:09 AM

hi

Is there anyway i can disable/lock the saved PDF after using RadFixedDocument to fill up the form field?

I do not want user to edit the field's content after they have filling up a web form and i merged the data to to the predefined PDF form.

Thank you.

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 20 Feb 2020, 01:53 PM

Hi Jimmy,

You can use the following approach for this:

var provider = new PdfFormatProvider();
var document = provider.Import(File.ReadAllBytes(@"..\..\filled_form.pdf"));

var fields = document.AcroForm.FormFields;

foreach (var item in fields)
{
    item.IsReadOnly = true;
}

using (FileStream fs = new FileStream(@"..\..\readOnly.pdf", FileMode.OpenOrCreate))
{
    provider.Export(document, fs);
} 

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PdfProcessing
Asked by
Jimmy
Top achievements
Rank 1
Iron
Veteran
Answers by
Dimitar
Telerik team
Share this question
or