Hello, I have a PDF form where I am manipulating the fields. When I try to use the example code I get the error - The method or operation is not implemented. The current trial version works with this code, but I am using an old version. Is this possible with the version I am using?
The form part seems to work ok, I just get the error on the final line. Is there another way to save the file with the R1.2021 version? Thank you!
File.WriteAllBytes(outputPath, pdfProvider.Export(document));
Full code from example:
string inputPath = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "PDFs\\ce_certificate.pdf";
string fileName = "certificate_" + drCE["series_id"] + "_" + drCE["member_id"] + ".pdf";
string outputPath = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "PDFs\\CECertificates\\" + fileName;
Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider pdfProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();
RadFixedDocument document = pdfProvider.Import(File.ReadAllBytes(inputPath));
foreach (RadFixedPage page in document.Pages)
{
foreach (Annotation annotation in page.Annotations)
{
if (annotation.Type == AnnotationType.Widget)
{
Widget widget = (Widget)annotation;
var field = widget.Field as TextBoxField;
if (field != null)
{
switch (field.Name)
{
case "member_name":
field.Value = drCE["full_name"].ToString();
break;
case "course_name":
field.Value = drCE["title"].ToString();
break;
case "ce_credits":
field.Value = drCE["total_credits"].ToString();
break;
case "completed_date":
field.Value = DateTime.Parse(drCE["complete_date"].ToString()).ToShortDateString();
break;
}
}
}
}
}
//not implemented in our version
//document.AcroForm.FlattenFormFields();
//not implemented in our version
File.WriteAllBytes(outputPath, pdfProvider.Export(document));