PdfProcessing: Value cannot be null. (Parameter 'action') when trying importing a document
I am getting a null exception when trying to import an document. The specified error is Value cannot be null. (Parameter 'action').
4 comments
Rhianne
Posted on:14 Nov 2023 18:18
Hi, Your solution fixed the issue. Thank you for your help.
ADMIN
Martin
Posted on:13 Nov 2023 08:09
Hi Rhianne,
Examining the provided documents it seems there are missing required named destination objects in their structure which leads to the observed exceptions. The "Name" for the first and third GoTo actions is not registered in the document`s Names (NamedDestination) collection:
I could suggest handling this exception using the handling mechanism described in the Handling Exceptions help article or:
PdfFormatProvider provider = new PdfFormatProvider();
provider.ImportSettings.DocumentUnhandledException += this.ImportSettings_DocumentUnhandledException;this.fixedDocument = provider.Import(str);
privatevoidImportSettings_DocumentUnhandledException(object sender, DocumentUnhandledExceptionEventArgs e)
{
if (e.Exception.Message == "Value cannot be null.\r\nParameter name: action")
{
e.Handled = true;
}
}
I hope this helps. Please, let me know if there is anything else I can assist you with.
Effected documents have been attached. The error are not directly loaded from the files.
The fillable fields on the pdf are filled with client data before being flattened and saved as a byte array. The error is occurring when we trying to view these specific pdfs from the byte array.
Here is the stack trace in case this helps
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Outlines.OutlineItemObject.<>c__DisplayClass33_0.<ToBookmarkItem>b__0() at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.ExceptionHandling.ExecutionHandler.TryHandleExecution[E](Action operation) at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Outlines.OutlineItemObject.ToBookmarkItem(PostScriptReader reader, IRadFixedDocumentImportContext context) at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.<>c__DisplayClass52_0.<CopyOutlinesTo>b__0() at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.ExceptionHandling.ExecutionHandler.TryHandleExecution[E](Action operation) at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyOutlinesTo(PostScriptReader reader, IRadFixedDocumentImportContext context) at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPropertiesTo(PostScriptReader reader, IRadFixedDocumentImportContext context) at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.RadFixedDocumentImportContext.BeginImportOverride() at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.BaseImportContext.BeginImport(Stream pdfFileStream) at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.PdfImporter.Import(Stream input, IPdfImportContext context) at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.<>c__DisplayClass18_0.<ImportOverride>b__0() at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.ExceptionHandling.ExecutionHandler.TryHandleExecution[E](Action operation) at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.ImportOverride(Stream input) at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Import(Stream input)
Would you be able to provide us with the document in question so I can inspect it, try to reproduce the results you are experiencing, and identify its cause? I can assure you that anything shared by our clients is treated with strict confidentiality and is used for testing purposes only (as per our EULA section 11).