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





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / SetJpeg2000Quality Method

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 Quality As Integer _
) 
public void SetJpeg2000Quality( 
   int Quality
)
public procedure SetJpeg2000Quality( 
    Quality: Integer
); 
public function SetJpeg2000Quality( 
   Quality : int
);
public: void SetJpeg2000Quality( 
   int Quality
) 
public:
void SetJpeg2000Quality( 
   int Quality
) 

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>
Remarks
It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any. Please ensure that you have successfully created or loaded a PDF document, otherwise the method does nothing.

JPEG2000 compression is only suitable for 8bpp grayscale and non indexed color images. Please use the SetCompressionForColorImage method to specify the compression scheme for other color images.

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