Skip to main content

AsyncConversion

Version: 1.1

cete.dynamicpdf.conversion.asyncconversion

AsyncConversion​

Represents an asynchronous conversion process.

public class AsyncConversion
Public Class AsyncConversion

Inheritance: Object → AsyncConversion

Examples​

This example shows how to convert files asynchronously.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' Create a instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

' Call Convert method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.Convert("C:\MyDocument.doc", "C:\MyOutput.pdf")

End Sub

End Module
using System;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// Create a instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(@"C:\MyDocument.doc", @"C:\MyOutput.pdf");
}
}

Properties​

Aborted​

Gets an indication whether the asynchronous operation has aborted.

public bool Aborted { get; }
Public Property Aborted As Boolean

Property Value​

Boolean

Completed​

Gets an indication whether the asynchronous operation has completed.

public bool Completed { get; }
Public Property Completed As Boolean

Property Value​

Boolean

Examples​

This example shows how to make use of IsCompleted property of AsyncConversion.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' Create a instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

' Call Convert method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.Convert("C:\MyDocument.doc", "C:\MyOutput.pdf")

While (True)
If (asyncConversion.Completed) Then
Console.WriteLine("File converted successfully")
Exit While
End If
End While

End Sub

End Module
using System;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// Create a instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(@"C:\MyDocument.doc", @"C:\MyOutput.pdf");

while(true)
{
if (asyncConversion.Completed)
{
Console.WriteLine("File converted successfully");
break;
}
}
}
}

Exception​

Gets the exception that occurred during the conversion operation.

public Exception Exception { get; }
Public Property Exception As Exception

Property Value​

Exception

Methods​

Abort()​

Abort the asynchronous conversion request.

public void Abort()
Sub Abort()

Remarks​

Call for abort immediately or after the conversion ends will throw an exception.

Equals(Object)​

Determines whether the specified Object is equal to the current Object . (Inherited from Object)

public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean

Parameters​

The Object to compare with the current Object .

Returns​

true if the specified Object is equal to the current Object ; otherwise, false.

GetHashCode()​

Serves as a hash function for a particular type. (Inherited from Object)

public int GetHashCode()
Function GetHashCode() As Integer

Returns​

A hash code for the current Object .

GetOutputData()​

Returns the byte array of the converted pdf.

public Byte[] GetOutputData()
Function GetOutputData() As Byte()

Returns​

Byte array of the converted PDF.

Examples​

This example shows how to make use of IsCompleted property of AsyncConversion.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' Create a instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

' Call Convert method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.Convert("C:\MyDocument.doc")

While (True)
If (asyncConversion.IsCompleted) Then
Dim MyData() As Byte = asyncConversion.GetOutputData()
Exit While
End If
End While

End Sub

End Module
using System;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// Create a instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(@"C:\MyDocument.doc");

while(true)
{
if (asyncConversion.IsCompleted)
{
byte[] MyData = asyncConversion.GetOutputData();
break;
}
}
}
}

Remarks​

Should be used when call to convert method was made without output path parameter.

GetType()​

Gets the Type of the current instance. (Inherited from Object)

public Type GetType()
Function GetType() As Type

Returns​

The Type instance that represents the exact runtime type of the current instance.

ToString()​

Returns a String that represents the current Object . (Inherited from Object)

public string ToString()
Function ToString() As String

Returns​

A String that represents the current Object .

See Also​

ceTe.DynamicPDF.Conversion