SetMRCImageBackgroundResolution Method (GdPicturePDF)
In This Topic
Sets the resolution of the background layer of the image, which is subsequently processed by the MRC engine, for example using the
AddImageFromGdPictureImage(Int32,PdfAdvancedImageCompression) method.
The predefined value is -1, which means that the original resolution of the input image is used.
Syntax
'Declaration
Public Sub SetMRCImageBackgroundResolution( _
ByVal As Single _
)
public void SetMRCImageBackgroundResolution(
float
)
public procedure SetMRCImageBackgroundResolution(
: Single
);
public function SetMRCImageBackgroundResolution(
: float
);
public: void SetMRCImageBackgroundResolution(
float
)
public:
void SetMRCImageBackgroundResolution(
float
)
Parameters
- Resolution
- The required resolution of the background layer of the resulting image produced by the MRC engine.
Set this parameter to -1, if you want to use the original resolution of the input image.
Example
How to affect the resolution of the background layer of the image compressed using the MRC engine.
Dim caption As String = "Example: SetMRCImageBackgroundResolution"
Dim gdpictureImaging As GdPictureImaging = New GdPictureImaging()
Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg")
If gdpictureImaging.GetStat() = GdPictureStatus.OK Then
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
If gdpicturePDF.NewPDF() = GdPictureStatus.OK Then
gdpicturePDF.SetMRCImageBackgroundResolution(100)
gdpicturePDF.SetMRCPreserveSmoothing(True)
If gdpicturePDF.AddImageFromGdPictureImage(imageID, PdfAdvancedImageCompression.PdfAdvancedImageCompressionMRC) = GdPictureStatus.OK Then
If gdpicturePDF.SaveToFile("image.pdf", True) = GdPictureStatus.OK Then
MessageBox.Show("The image has been added successfully and the file has been saved.", caption)
Else
MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The AddImageFromGdPictureImage() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The NewPDF() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
gdpicturePDF.Dispose()
Else
MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption)
End If
gdpictureImaging.ReleaseGdPictureImage(imageID)
gdpictureImaging.Dispose()
string caption = "Example: SetMRCImageBackgroundResolution";
GdPictureImaging gdpictureImaging = new GdPictureImaging();
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg");
if (gdpictureImaging.GetStat() == GdPictureStatus.OK)
{
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.NewPDF() == GdPictureStatus.OK)
{
gdpicturePDF.SetMRCImageBackgroundResolution(100);
gdpicturePDF.SetMRCPreserveSmoothing(true);
if (gdpicturePDF.AddImageFromGdPictureImage(imageID, PdfAdvancedImageCompression.PdfAdvancedImageCompressionMRC) == GdPictureStatus.OK)
{
if (gdpicturePDF.SaveToFile("image.pdf", true) == GdPictureStatus.OK)
MessageBox.Show("The image has been added successfully and the file has been saved.", caption);
else
MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption);
}
else
MessageBox.Show("The AddImageFromGdPictureImage() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
MessageBox.Show("The NewPDF() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
gdpicturePDF.Dispose();
}
else
MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption);
gdpictureImaging.ReleaseGdPictureImage(imageID);
gdpictureImaging.Dispose();
Example
How to affect the resolution of the background layer of the image compressed using the MRC engine.
Dim caption As String = "Example: SetMRCImageBackgroundResolution"
Dim gdpictureImaging As GdPictureImaging = New GdPictureImaging()
Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg")
If gdpictureImaging.GetStat() = GdPictureStatus.OK Then
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
If gdpicturePDF.NewPDF() = GdPictureStatus.OK Then
gdpicturePDF.SetMRCImageBackgroundResolution(100)
gdpicturePDF.SetMRCPreserveSmoothing(True)
If gdpicturePDF.AddImageFromGdPictureImage(imageID, PdfAdvancedImageCompression.PdfAdvancedImageCompressionMRC) = GdPictureStatus.OK Then
If gdpicturePDF.SaveToFile("image.pdf", True) = GdPictureStatus.OK Then
MessageBox.Show("The image has been added successfully and the file has been saved.", caption)
Else
MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The AddImageFromGdPictureImage() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The NewPDF() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
gdpicturePDF.Dispose()
Else
MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption)
End If
gdpictureImaging.ReleaseGdPictureImage(imageID)
gdpictureImaging.Dispose()
string caption = "Example: SetMRCImageBackgroundResolution";
GdPictureImaging gdpictureImaging = new GdPictureImaging();
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg");
if (gdpictureImaging.GetStat() == GdPictureStatus.OK)
{
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.NewPDF() == GdPictureStatus.OK)
{
gdpicturePDF.SetMRCImageBackgroundResolution(100);
gdpicturePDF.SetMRCPreserveSmoothing(true);
if (gdpicturePDF.AddImageFromGdPictureImage(imageID, PdfAdvancedImageCompression.PdfAdvancedImageCompressionMRC) == GdPictureStatus.OK)
{
if (gdpicturePDF.SaveToFile("image.pdf", true) == GdPictureStatus.OK)
MessageBox.Show("The image has been added successfully and the file has been saved.", caption);
else
MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption);
}
else
MessageBox.Show("The AddImageFromGdPictureImage() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
MessageBox.Show("The NewPDF() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
gdpicturePDF.Dispose();
}
else
MessageBox.Show("The CreateGdPictureImageFromFile() method has failed with the status: " + gdpictureImaging.GetStat().ToString(), caption);
gdpictureImaging.ReleaseGdPictureImage(imageID);
gdpictureImaging.Dispose();
See Also