Declined
Last Updated: 07 Jul 2021 11:45 by ADMIN
Charles
Created on: 06 Jul 2021 17:53
Category: PdfProcessing
Type: Feature Request
0
Open a Pdf Containing Unsupported Actions

Attempting to open a Pdf document containing an unsupported action type results in a NotSupportedActionException being thrown (see PdfProcessing: Add support for actions of type Launch).

 

Can the behavior be changed to ignore unsupported actions and allow the document to be opened?

 
1 comment
ADMIN
Martin
Posted on: 07 Jul 2021 11:45

Hi Charles,

You can handle such exceptions using the exception handling mechanism described in the Handling Exceptions help article.

This is an example using the previously provided code snippet: 

using (Stream stream = File.OpenRead(inputFileName))
{
	PdfFormatProvider provider = new PdfFormatProvider();
	provider.ImportSettings.ReadingMode = ReadingMode.OnDemand;

	RadFixedDocument document = provider.Import(stream);

	document.DocumentUnhandledException += Document_DocumentUnhandledException;

	using (Stream ostream = File.OpenWrite(outputFileName))
	{
		PdfFormatProvider expProvider = new PdfFormatProvider();
		expProvider.ExportSettings.ComplianceLevel = PdfComplianceLevel.None;
		expProvider.Export(document, ostream);
	}
}

and the exception handler:

private static void Document_DocumentUnhandledException(object sender, DocumentUnhandledExceptionEventArgs e)
{
	if (e.Exception is NotSupportedActionException)
	{
		e.Handled = true;
	}
}

I updated the feature request public item with this information as well.

Do not hesitate to contact us if any additional questions arise.

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.