GdPicture.NET.14
GdPicture14 Namespace / GdPictureDocumentConverter Class / DocxImageQuality Property
Example





In This Topic
DocxImageQuality Property (GdPictureDocumentConverter)
In This Topic
Sets the level of quality used to compress images with a lossy compression scheme, which are embedded in the newly produced DOCX document when converting/saving the currently loaded document to DOCX format.

It must be a value from 0 to 100. 0 means the worst quality and the best compression, 100 means the best quality and the worst compression.

Syntax
'Declaration
 
Public Property DocxImageQuality As Integer
public int DocxImageQuality {get; set;}
public read-write property DocxImageQuality: Integer; 
public function get,set DocxImageQuality : int
public: __property int get_DocxImageQuality();
public: __property void set_DocxImageQuality( 
   int value
);
public:
property int DocxImageQuality {
   int get();
   void set (    int value);
}

Property Value

The default value is 75.
Example
Setting up the level of quality for image compression.
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    Dim status As GdPictureStatus = gdpictureDocumentConverter.LoadFromFile("input.jpg", GdPicture14.DocumentFormat.DocumentFormatJPEG)
    If status = GdPictureStatus.OK Then
        MessageBox.Show("The file has been loaded successfully.", "GdPicture")
        'Set the required level of quality here.
        gdpictureDocumentConverter.DocxImageQuality = 50
        status = gdpictureDocumentConverter.SaveAsDOCX("output.docx")
        If status = GdPictureStatus.OK Then
            MessageBox.Show("The file has been saved successfully.", "GdPicture")
        Else
            MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "GdPicture")
        End If
    Else
        MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "GdPicture")
    End If
End Using
using (GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter())
{
    GdPictureStatus status = gdpictureDocumentConverter.LoadFromFile("input.jpg", GdPicture14.DocumentFormat.DocumentFormatJPEG);
    if (status == GdPictureStatus.OK)
    {
        MessageBox.Show("The file has been loaded successfully.", "GdPicture");
        //Set the required level of quality here.
        gdpictureDocumentConverter.DocxImageQuality = 50;
        status = gdpictureDocumentConverter.SaveAsDOCX("output.docx");
        if (status == GdPictureStatus.OK)
        {
            MessageBox.Show("The file has been saved successfully.", "GdPicture");
        }
        else
        {
            MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "GdPicture");
        }
    }
    else
    {
        MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "GdPicture");
    }
}
See Also