cete.dynamicpdf.conversion.imageconverter
ImageConverter
- Namespace: ceTe.DynamicPDF.Conversion
- Assemblies: DynamicPDF.Converter.dll
Defines methods and properties for the ImageConverter.
public class ImageConverter
Public Class ImageConverter
Inheritance: Object → ImageConverter
Licensing Info
This class is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
Example shows how to use ImageConverter class.
Imports ceTe.DynamicPDF.Conversion
Module Module1
Sub Main()
' create new instance of ImageConversionOptions.
Dim conversionOptions As ImageConversionOptions = New ImageConversionOptions(True)
' Create new instance of Converter by providing suitable parameters.
Dim imageConverter As ImageConverter = New ImageConverter("C:\MyDocument.jpg",conversionOptions)
' Call Convert method to start conversion
imageConverter.Convert("C:\MyOutput.pdf")
End Sub
End Module
using ceTe.DynamicPDF.Conversion;
class MyClass
{
static void Main()
{
// create new instance of ImageConversionOptions.
ImageConversionOptions conversionOptions = new ImageConversionOptions(true);
// Create new instance of Converter by providing suitable parameters.
ImageConverter imageConverter = new ImageConverter(@"C:\MyDocument.jpg", conversionOptions);
//Call Convert method to start conversion
imageConverter.Convert(@"C:\MyOutput.pdf");
}
}
Constructors
ImageConverter(Byte[])
Creates an instance of the ImageConverter class.
public ImageConverter(Byte[] imageData)
Public Sub New (imageData As Byte())
Parameters
- imageData: Byte[]
Image data in byte array format
Licensing Info
This constructor is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
Example shows how to use ImageConverter with inputbyte array as parameter.
Imports ceTe.DynamicPDF.Conversion
Module Module1
Sub Main()
Dim imageInputByte As Byte()=File.ReadAllBytes("C:\MyDocument.jpg")
' Create new instance of Converter by providing suitable parameters.
Dim imageConverter As ImageConverter = New ImageConverter(imageInputByte)
' Call Convert method to start conversion
imageConverter.Convert("C:\MyOutput.pdf")
End Sub
End Module
using ceTe.DynamicPDF.Conversion;
class MyClass
{
static void Main()
{
byte[] imageInputByte=File.ReadAllBytes("C:\MyDocument.jpg");
// Create new instance of Converter by providing suitable parameters.
ImageConverter imageConverter = new ImageConverter(imageInputByte);
//Call Convert method to start conversion
imageConverter.Convert(@"C:\MyOutput.pdf");
}
}
ImageConverter(Byte[], ImageConversionOptions)
Creates an instance of the ImageConverter class.
public ImageConverter(Byte[] imageData, ImageConversionOptions conversionOptions)
Public Sub New (imageData As Byte(), conversionOptions As ImageConversionOptions)
Parameters
- imageData: Byte[]
Image data in byte array format
- conversionOptions: ImageConversionOptions
Initializes the ConversionOptions property of the class.
Licensing Info
This constructor is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
Example shows how to use ImageConverter with inputbyte array as parameter.
Imports ceTe.DynamicPDF.Conversion
Module Module1
Sub Main()
' create new instance of ImageConversionOptions.
Dim conversionOptions As ImageConversionOptions = New ImageConversionOptions(True)
Dim imageInputByte As Byte()=File.ReadAllBytes("C:\MyDocument.jpg")
' Create new instance of Converter by providing suitable parameters.
Dim imageConverter As ImageConverter = New ImageConverter(imageInputByte,conversionOptions)
' Call Convert method to start conversion
imageConverter.Convert("C:\MyOutput.pdf")
End Sub
End Module
using ceTe.DynamicPDF.Conversion;
class MyClass
{
static void Main()
{
// create new instance of ImageConversionOptions.
ImageConversionOptions conversionOptions = new ImageConversionOptions(true);
byte[] imageInputByte=File.ReadAllBytes("C:\MyDocument.jpg");
// Create new instance of Converter by providing suitable parameters.
ImageConverter imageConverter = new ImageConverter(imageInputByte, conversionOptions);
//Call Convert method to start conversion
imageConverter.Convert(@"C:\MyOutput.pdf");
}
}
ImageConverter(String)
Creates an instance of the ImageConverter class.
public ImageConverter(string inputFilePath)
Public Sub New (inputFilePath As String)
Parameters
- inputFilePath: String
Path where the image is located
Licensing Info
This constructor is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
Example shows how to use ImageConverter.
Imports ceTe.DynamicPDF.Conversion
Module Module1
Sub Main()
' Create new instance of Converter by providing suitable parameters.
Dim imageConverter As ImageConverter = New ImageConverter("C:\MyDocument.jpg")
' Call Convert method to start conversion
imageConverter.Convert("C:\MyOutput.pdf")
End Sub
End Module
using ceTe.DynamicPDF.Conversion;
class MyClass
{
static void Main()
{
// Create new instance of Converter by providing suitable parameters.
ImageConverter imageConverter = new ImageConverter(@"C:\MyDocument.jpg");
//Call Convert method to start conversion
imageConverter.Convert(@"C:\MyOutput.pdf");
}
}
ImageConverter(String, ImageConversionOptions)
Creates an instance of the ImageConverter class.
public ImageConverter(string inputFilePath, ImageConversionOptions conversionOptions)
Public Sub New (inputFilePath As String, conversionOptions As ImageConversionOptions)
Parameters
- inputFilePath: String
Path where the image is located
- conversionOptions: ImageConversionOptions
Initializes the ConversionOptions property of the class.
Licensing Info
This constructor is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
Example shows how to use ImageConverter with inputFilePath and ConversionOptions as parameter.
Imports ceTe.DynamicPDF.Conversion
Module Module1
Sub Main()
' create new instance of ImageConversionOptions.
Dim conversionOptions As ImageConversionOptions = New ImageConversionOptions(True)
' Create new instance of Converter by providing suitable parameters.
Dim imageConverter As ImageConverter = New ImageConverter("C:\MyDocument.jpg",conversionOptions)
' Call Convert method to start conversion
imageConverter.Convert("C:\MyOutput.pdf")
End Sub
End Module
using ceTe.DynamicPDF.Conversion;
class MyClass
{
static void Main()
{
// create new instance of ImageConversionOptions.
ImageConversionOptions conversionOptions = new ImageConversionOptions(true);
// Create new instance of Converter by providing suitable parameters.
ImageConverter imageConverter = new ImageConverter(@"C:\MyDocument.jpg", conversionOptions);
//Call Convert method to start conversion
imageConverter.Convert(@"C:\MyOutput.pdf");
}
}
Properties
ConversionOptions
Gets the instance of the ImageConversionOptions class
public ImageConversionOptions ConversionOptions { get; }
Public Property ConversionOptions As ImageConversionOptions
Property Value
Licensing Info
This property is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Methods
Convert()
Converts Image to Pdf
public Byte[] Convert()
Function Convert() As Byte()
Returns
returns a output pdf byte array
Licensing Info
This method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
This example shows how to use convert method with output byte array as return type.
Imports ceTe.DynamicPDF.Conversion
Module Module1
Sub Main()
' Create new instance of Converter by providing suitable parameters.
Dim imageConversion As ImageConverter = New ImageConverter("C:\MyDocument.jpg")
' Call Convert method to start conversion
Dim output As Byte() = imageConversion.Convert()
If (output IsNot Nothing) Then
'save byte array output to a file.
File.WriteAllBytes("C:\MyOutputFile.pdf", output)
End If
End Sub
End Module
using ceTe.DynamicPDF.Conversion;
class MyClass
{
static void Main()
{
// Create new instance of Converter.
ImageConverter image = new ImageConverter(@"C:\MyDocument.jpg");
//Call Convert method to start conversion
byte []output=image.Convert();
if(output!=null)
{
//save byte array output to a file.
File.WriteAllBytes("C:\MyOutputFile.pdf",output);
}
}
}
Convert(Byte[])
Converts Image to Pdf
public Byte[] Convert(Byte[] pdfToAppendTo)
Function Convert(pdfToAppendTo As Byte()) As Byte()
Parameters
- pdfToAppendTo: Byte[]
Contents of Pdf in byte array format, to which the current conversion needs to be appended to
Returns
returns a Task where the result type is byte array
Licensing Info
This method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
This example shows how to use convert method with appendToPdf as parameter and output byte array as return type.
Imports ceTe.DynamicPDF.Conversion
Module Module1
Sub Main()
' Create new instance of Converter by providing suitable parameters.
Dim imageConversion As ImageConverter = New ImageConverter("C:\MyDocument.jpg")
' Call Convert method to start conversion
Dim output As Byte() = imageConversion.Convert()
If (output IsNot Nothing) Then
Dim finalOutput As Byte() = imageConversion.Convert(output)
'save byte array output to a file.
File.WriteAllBytes("C:\MyOutputFile.pdf", finalOutput)
End If
End Sub
End Module
using ceTe.DynamicPDF.Conversion;
class MyClass
{
static void Main()
{
// Create new instance of Converter.
ImageConverter image = new ImageConverter(@"C:\MyDocument.jpg");
//Call Convert method to start conversion
byte []output=image.Convert();
if(output!=null)
{
byte []finalOutputByte=image.Convert(output);
//save byte array output to a file.
File.WriteAllBytes("C:\MyOutputFile.pdf",finalOutputByte);
}
}
}
Convert(String)
Converts Image to Pdf
public void Convert(string outputFilePath)
Sub Convert(outputFilePath As String)
Parameters
- outputFilePath: String
Path where the output file needs to be saved
Licensing Info
This method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
Example shows how to use ImageConverter.
Imports ceTe.DynamicPDF.Conversion
Module Module1
Sub Main()
' Create new instance of Converter by providing suitable parameters.
Dim imageConverter As ImageConverter = New ImageConverter("C:\MyDocument.jpg",conversionOptions)
' Call Convert method to start conversion
imageConverter.Convert("C:\MyOutput.pdf")
End Sub
End Module
using ceTe.DynamicPDF.Conversion;
class MyClass
{
static void Main()
{
// Create new instance of Converter by providing suitable parameters.
ImageConverter imageConverter = new ImageConverter(@"C:\MyDocument.jpg", conversionOptions);
//Call Convert method to start conversion
imageConverter.Convert(@"C:\MyOutput.pdf");
}
}
ConvertAsync()
Does the Asynchronous conversion
public Task<Byte[]> ConvertAsync()
Function ConvertAsync() As Task(Of Byte())
Returns
returns a Task where the result type is byte array
Licensing Info
This method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
This example shows how to use convert method with outputFilePath as parameter.
Imports ceTe.DynamicPDF.Conversion
Module Module1
Async Function run() As Task
' Create new instance of Converter by providing suitable parameters.
Dim imageConversion As ImageConverter = New ImageConverter("C:\MyDocument.jpg")
' Call Convert method to start conversion
Dim result= Await imageConversion.ConvertAsync()
If (result IsNot Nothing) Then
File.WriteAllBytes("C:\MyDocument.pdf",result)
End If
End Function
Sub Main()
run().Wait()
End Sub
End Module
using ceTe.DynamicPDF.Conversion;
using System.IO;
class MyClass
{
static async Task run()
{
// Create new instance of Converter.
ImageConverter image = new ImageConverter(@"C:\MyDocument.jpg");
//Call Convert method to start conversion
byte[] result=await image.ConvertAsync();
if(result!=null)
{
File.WriteAllBytes("C:\MyDocument.pdf", result);
}
}
static void Main()
{
run().Wait();
}
}
ConvertAsync(Byte[])
Does the Asynchronous conversion
public Task<Byte[]> ConvertAsync(Byte[] pdfToAppendTo)
Function ConvertAsync(pdfToAppendTo As Byte()) As Task(Of Byte())
Parameters
- pdfToAppendTo: Byte[]
Contents of Pdf in byte array format, to which the current conversion needs to be appended to
Returns
returns a Task where the result type is byte array
Licensing Info
This method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
This example shows how to use convert method with pdf byte array as parameter and byte array as return type.
Imports ceTe.DynamicPDF.Conversion
Module Module1
Sub Main()
' Create new instance of Converter by providing suitable parameters.
Dim imageConversion As ImageConverter = New ImageConverter("C:\MyDocument.jpg")
' Call Convert method to start conversion
Dim output As Byte() =Await imageConversion.ConvertAsyncs()
If (output IsNot Nothing) Then
Dim finalOutput As Byte() =Await imageConversion.ConvertAsync(output)
'save byte array output to a file.
File.WriteAllBytes("C:\MyOutputFile.pdf", finalOutput)
End If
End Sub
End Module
using ceTe.DynamicPDF.Conversion;
class MyClass
{
static void Main()
{
// Create new instance of Converter.
ImageConverter image = new ImageConverter(@"C:\MyDocument.jpg");
//Call Convert method to start conversion
byte []output=await image.ConvertAsync();
if(output!=null)
{
byte []finalOutputByte=await image.ConvertAsync(output);
//save byte array output to a file.
File.WriteAllBytes("C:\MyOutputFile.pdf",finalOutputByte);
}
}
}
ConvertAsync(String)
Does the Asynchronous conversion
public Task<bool> ConvertAsync(string outputFilePath)
Function ConvertAsync(outputFilePath As String) As Task(Of Boolean)
Parameters
- outputFilePath: String
Returns
Licensing Info
This method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Examples
This example shows how to use convert method with outputFilePath as parameter.
Imports ceTe.DynamicPDF.Conversion
Module Module1
Async Function run() As Task
' Create new instance of Converter by providing suitable parameters.
Dim imageConversion As ImageConverter = New ImageConverter("C:\MyDocument.jpg")
' Call Convert method to start conversion
Dim result= Await imageConversion.ConvertAsync("C:\MyOutput.pdf")
while(True)
If (result) Then
Console.WriteLine("Completed successfully);
Exit While
End If
End While
End If
End Function
Sub Main()
run().Wait()
End Sub
End Module
using ceTe.DynamicPDF.Conversion;
using Syste.IO;
class MyClass
{
static async Task run()
{
// Create new instance of Converter.
ImageConverter image = new ImageConverter(@"C:\MyDocument.jpg");
//Call Convert method to start conversion
bool result=await image.ConvertAsync(@"C:\MyOutput.pdf");
if(result)
{
Console.WriteLine("Completed successfully);
}
}
static void Main()
{
run().Wait();
}
}
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
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
Licensing Info
This method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
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 .
Licensing Info
This method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
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.
Licensing Info
This method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
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 .
Licensing Info
This method is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
Events
Completed
Occurs when a document is successfully converted.
public event ConversionCompleted ImageConverter.Completed;
Public Event ImageConverter.Completed As ConversionCompleted
Event Handler
Licensing Info
This event is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.
ProgressChanged
Occurs when the status of a document conversion changes.
public event ProgressChanged ImageConverter.ProgressChanged;
Public Event ImageConverter.ProgressChanged As ProgressChanged
Event Handler
Licensing Info
This event is a DynamicPDF Converter feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF https://www.dynamicpdf.com/ultimate-subscription Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Converter selected.
- A DynamicPDF Converter for .NET v3.X Developer license.