Dim caption As String = "Example: SetCompressionForColorImage"
Dim oImage As GdPictureImaging = New GdPictureImaging()
Dim imageID As Integer = oImage.CreateGdPictureImageFromFile("input.jpg")
If oImage.GetStat() = GdPictureStatus.OK Then
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
'Firstly, create or load the PDF document.
If gdpicturePDF.NewPDF() = GdPictureStatus.OK Then
'Secondly, set the required compression.
gdpicturePDF.SetCompressionForColorImage(PdfCompression.PdfCompressionJPEG2000)
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
'Process your document.
status = gdpicturePDF.AddImageFromGdPictureImage(imageID, PdfAdvancedImageCompression.PdfAdvancedImageCompressionNone)
If status = GdPictureStatus.OK Then
'At the end, save the file with the previously selected compression.
If gdpicturePDF.SaveToFile("output.pdf", False) = GdPictureStatus.OK Then
MessageBox.Show("Done!", caption)
Else
MessageBox.Show("The file can't be saved. Status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The AddImageFromGdPictureImage() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The SetCompressionForBitonalImage() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The new PDF document can't be created. Status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The image can't be created. Status: " + oImage.GetStat().ToString(), caption)
End If
string caption = "Example: SetCompressionForColorImage";
GdPictureImaging oImage = new GdPictureImaging();
int imageID = oImage.CreateGdPictureImageFromFile("input.jpg");
if (oImage.GetStat() == GdPictureStatus.OK)
{
GdPicturePDF gdpicturePDF = new GdPicturePDF();
//Firstly, create or load the PDF document.
if (gdpicturePDF.NewPDF() == GdPictureStatus.OK)
{
//Secondly, set the required compression.
gdpicturePDF.SetCompressionForColorImage(PdfCompression.PdfCompressionJPEG2000);
GdPictureStatus status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
//Process your document.
status = gdpicturePDF.AddImageFromGdPictureImage(imageID, PdfAdvancedImageCompression.PdfAdvancedImageCompressionNone);
if (status == GdPictureStatus.OK)
{
//At the end, save the file with the previously selected compression.
if (gdpicturePDF.SaveToFile("output.pdf", false) == GdPictureStatus.OK)
MessageBox.Show("Done!", caption);
else
MessageBox.Show("The file can't be saved. Status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
{
MessageBox.Show("The AddImageFromGdPictureImage() method has failed with the status: " + status.ToString(), caption);
}
}
else
MessageBox.Show("The SetCompressionForColorImage() method has failed with the status: " + status.ToString(), caption);
}
else
MessageBox.Show("The new PDF document can't be created. Status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
MessageBox.Show("The image can't be created. Status: " + oImage.GetStat().ToString(), caption);