security - How can I prefill a PDF form with iTextSharp while still having it be editable and saveable in Adobe Reader by other users? -
right have form template has fields prefilled database using itextsharp library. users fill in rest of fields , save filled out forms. i'll extract data , put in database.
currently able create pdfs , pre-filling fine. i'm able edit , save them in adobe reader on computer. i'm finding when else opens same files, they're not allowed save forms.
what need allow forms saved users using adobe reader? here's code have create pdf:
dim pdfreader pdfreader = new pdfreader(formpath) pdfreader.removeusagerights() dim pdfstamper pdfstamper = new pdfstamper(pdfreader, new filestream(outputpath, filemode.create)) dim pdfformfields acrofields = pdfstamper.acrofields dim xfdfreader xfdfreader = new xfdfreader(xfdfpath) pdfformfields.setfields(xfdfreader) pdfstamper.close()
i used have problem couldn't save forms in reader, , that's why added line:
pdfreader.removeusagerights()
that made i can edit pdf creates, made me think resolved. nobody else can.
please consult example readerenabledform.cs. describes different ways fill out reader enabled form:
- breaking reader-enabling
- removing reader-enabling
- preserving reader-enabling
you've tried 1 , 2, whereas you're asking 3, involving adding parameters when creating pdfstamper instance:
new pdfstamper(pdfreader, new filestream(outputpath, filemode.create), '\0', true);
Comments
Post a Comment