SetJpegQuality Method (GdPicturePDF)
In This Topic
Changes the level of quality used to compress JPEG image within the currently loaded PDF document.
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 compression level before adding the required image to the current document.
Syntax
'Declaration
Public Sub SetJpegQuality( _
ByVal As Integer _
)
public void SetJpegQuality(
int
)
public procedure SetJpegQuality(
: Integer
);
public function SetJpegQuality(
: int
);
public: void SetJpegQuality(
int
)
public:
void SetJpegQuality(
int
)
Parameters
- Quality
- The compression quality level from 0 to 100. 0 means the worst quality and the best compression, 100 means the best quality and the worst compression. The default value is 75.
Example
How to set the compression level 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.SetJpegQuality(80)
'Process your document here, for example, add an image.
Else
MessageBox.Show("The file can't be loaded.", "Example: SetJpegQuality")
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.SetJpegQuality(80);
//Process your document here, for example, add an image.
}
else
MessageBox.Show("The file can't be loaded.", "Example: SetJpegQuality");
gdpicturePDF.Dispose();
Example
How to set the compression level 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.SetJpegQuality(80)
'Process your document here, for example, add an image.
Else
MessageBox.Show("The file can't be loaded.", "Example: SetJpegQuality")
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.SetJpegQuality(80);
//Process your document here, for example, add an image.
}
else
MessageBox.Show("The file can't be loaded.", "Example: SetJpegQuality");
gdpicturePDF.Dispose();
See Also