GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / ConvertToGrayscale Method / ConvertToGrayscale(Boolean,Boolean,Boolean,Boolean,Boolean) Method
Set this parameter to true if you want to convert all text on page to grayscale, otherwise set it to false.
Set this parameter to true if you want to convert all path - based graphic objects on page to grayscale, otherwise set it to false.
Set this parameter to true if you want to convert all images on page to grayscale, otherwise set it to false.
Set this parameter to true if you want to convert all annotations on page to grayscale, otherwise set it to false.
Set this parameter to true if you want to convert all form fields on page to grayscale, otherwise set it to false.
Example





In This Topic
ConvertToGrayscale(Boolean,Boolean,Boolean,Boolean,Boolean) Method
In This Topic
Converts specified content of currently selected page of the loaded PDF document to grayscale.
Syntax
'Declaration
 
Public Overloads Function ConvertToGrayscale( _
   ByVal Text As Boolean, _
   ByVal Graphics As Boolean, _
   ByVal Images As Boolean, _
   ByVal Annotations As Boolean, _
   ByVal FormFields As Boolean _
) As GdPictureStatus
public GdPictureStatus ConvertToGrayscale( 
   bool Text,
   bool Graphics,
   bool Images,
   bool Annotations,
   bool FormFields
)
public function ConvertToGrayscale( 
    Text: Boolean;
    Graphics: Boolean;
    Images: Boolean;
    Annotations: Boolean;
    FormFields: Boolean
): GdPictureStatus; 
public function ConvertToGrayscale( 
   Text : boolean,
   Graphics : boolean,
   Images : boolean,
   Annotations : boolean,
   FormFields : boolean
) : GdPictureStatus;
public: GdPictureStatus ConvertToGrayscale( 
   bool Text,
   bool Graphics,
   bool Images,
   bool Annotations,
   bool FormFields
) 
public:
GdPictureStatus ConvertToGrayscale( 
   bool Text,
   bool Graphics,
   bool Images,
   bool Annotations,
   bool FormFields
) 

Parameters

Text
Set this parameter to true if you want to convert all text on page to grayscale, otherwise set it to false.
Graphics
Set this parameter to true if you want to convert all path - based graphic objects on page to grayscale, otherwise set it to false.
Images
Set this parameter to true if you want to convert all images on page to grayscale, otherwise set it to false.
Annotations
Set this parameter to true if you want to convert all annotations on page to grayscale, otherwise set it to false.
FormFields
Set this parameter to true if you want to convert all form fields on page to grayscale, otherwise set it to false.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Example
How to convert images on the selected page to grayscale.
Using gdpicturePDF As New GdPicturePDF
    gdpicturePDF.LoadFromFile("input.pdf")
    gdpicturePDF.SelectPage(2)
    gdpicturePDF.ConvertToGrayscale(False, False, True, False, False)
    gdpicturePDF.SaveToFile("output.pdf")
End Using
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
    gdpicturePDF.LoadFromFile("input.pdf");
    gdpicturePDF.SelectPage(2);
    gdpicturePDF.ConvertToGrayscale(false, false, true, false, false);
    gdpicturePDF.SaveToFile("output.pdf");
}
See Also