SetJpeg2000Quality Method (GdPicturePDF)
In This Topic
Changes the level of quality (compression rate or quality score) used to compress JPEG2000 image within the currently loaded PDF document. You can set the Quality parameter in two ways. Positive values specify the compression rate and negative values define the quality score.
Please note that firstly you need to create or load the PDF document to allow this setting to work properly. Secondly, you need to set the required value before adding the source image to the current document.
Syntax
'Declaration
Public Sub SetJpeg2000Quality( _
ByVal As Integer _
)
public void SetJpeg2000Quality(
int
)
public procedure SetJpeg2000Quality(
: Integer
);
public function SetJpeg2000Quality(
: int
);
public: void SetJpeg2000Quality(
int
)
public:
void SetJpeg2000Quality(
int
)
Parameters
- Quality
- Positive values determine the compression rate between 1 (maximal - lossless) and 512 (poor). Negative values determine the quality score between -1 (worst quality) and -100 (best quality).
The default value is 16.
para>
Example
How to set the compression rate correctly.
Dim gdpicturePDF As New GdPicturePDF()
'Firstly, create or load the PDF document.
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
'Set the required parameter.
gdpicturePDF.SetJpeg2000Quality(20)
'Process your document here, for example, add an image.
Else
MessageBox.Show("The file can't be loaded.", "Example: SetJpeg2000Quality")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
//Firstly, create or load the PDF document.
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
//Set the required parameter.
gdpicturePDF.SetJpeg2000Quality(20);
//Process your document here, for example, add an image.
}
else
MessageBox.Show("The file can't be loaded.", "Example: SetJpeg2000Quality");
gdpicturePDF.Dispose();
Example
How to set the compression rate correctly.
Dim gdpicturePDF As New GdPicturePDF()
'Firstly, create or load the PDF document.
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
'Set the required parameter.
gdpicturePDF.SetJpeg2000Quality(20)
'Process your document here, for example, add an image.
Else
MessageBox.Show("The file can't be loaded.", "Example: SetJpeg2000Quality")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
//Firstly, create or load the PDF document.
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
//Set the required parameter.
gdpicturePDF.SetJpeg2000Quality(20);
//Process your document here, for example, add an image.
}
else
MessageBox.Show("The file can't be loaded.", "Example: SetJpeg2000Quality");
gdpicturePDF.Dispose();
See Also