ConversionOptions.CancelToken Property
Gets or sets a CancellationToken for conversion task.
public CancellationToken CancelToken { get; set; }
Public Property CancelToken As CancellationToken
Property Value
Licensing Info
This property is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
Following code will cancel the conversion if it does not finish within a second.ConversionOptions conversionOptions = new ConversionOptions(PageSize.A4, PageOrientation.Portrait, 20);
CancellationTokenSource tokenSource = new CancellationTokenSource();
conversionOptions.CancelToken = tokenSource.Token;
System.Threading.Tasks.Task.Run(() => { Thread.Sleep(1000); tokenSource.Cancel(); });
byte[] pdf = await Converter.ConvertAsync(new Uri("http://www.dynamicpdf.com"), conversionOptions);
Remarks
This property will be used to create the task for conversion, so that the task may be cancelled if needed.