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 HTML Converter feature. One of the following is required for non-evaluation usage:
- Any active DynamicPDF Subscription (Essentials, Professional, Professional Plus or Ultimate).
- A DynamicPDF HTML Converter for .NET v2.X Essentials license.
- It can also be used for free with a public link back to www.dynamicpdf.com and with the DynamicPDF Essentials message displaying on the bottom of each page.
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.