Setting a filter on a mask results in an invalid file when exporting.
Workaround: Set the filer like this:
PdfFormatProvider provider = new PdfFormatProvider();
provider.ExportSettings.ImageCompression = new ImageFilterTypes[] { ImageFilterTypes.FlateDecode };
PdfFormatProvider provider = new PdfFormatProvider();
provider.ExportSettings.ImageCompression = new ImageFilterTypes[] { ImageFilterTypes.FlateDecode };
When a document containing a SignatureField is exported with the IsEncrypted property set to true, a not set UserPassword is required to open it, which makes it impossible to be opened.
Workaround: Exporting with AES256 encryption does not have this problem:
provider.ExportSettings = new PdfExportSettings
{
IsEncrypted = true,
EncryptionType = EncryptionType.AES256
};
Trying to clone the Signature of a SignatureField leads to InvalidOperationException as the FieldName of the cloned signature is already set.
Workaround: Remove the signatures before the merging of the document:
private static void RemoveSignatures(RadFixedDocument document)
{
List<FormField> signatures = document.AcroForm.FormFields.Where(ff => ff.FieldType == FormFieldType.Signature).ToList();
if (signatures.Count > 0)
{
foreach (FormField signature in signatures)
{
document.AcroForm.FormFields.Remove(signature);
}
}
List<SignatureWidget> signatureWidgets = document.Annotations.Where(a => a.Type == AnnotationType.Widget && a.GetType() == typeof(SignatureWidget)).Cast<SignatureWidget>().ToList();
if (signatureWidgets.Count > 0)
{
foreach (var signatureWidget in signatureWidgets)
{
foreach (RadFixedPage page in document.Pages)
{
if (page.Annotations.Contains(signatureWidget))
{
page.Annotations.Remove(signatureWidget);
}
}
}
}
}
InvalidOperationException Cannot find the "endstream" keyword with a specific file.
According to the PDF Specification:
A stream consists of a dictionary followed by zero or more bytes bracketed between the keywords stream and endstream:
dictionary
stream
… Zero or more bytes …
endstream
This exception seems to be related to AES algorithm PaddingMode property.