GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / SaveDocumentToJPEG Method / SaveDocumentToJPEG(String,Int32) Method
The file path including the full document name, where the resulting JPEG file will be saved.
The compression quality level from 0 to 100 to be used to compress the resulting JPEG file. 0 means worse quality and better compression, 100 means the best quality and worse compression.
Example





In This Topic
SaveDocumentToJPEG(String,Int32) Method
In This Topic
Saves the document displayed in the GdViewer control to a file in JPEG format according to a file path you have specified. The file is saved with full GdPicture/XMP annotation support.

Please consider using the BurnAnnotationsToPage(Boolean) method before saving, if you expect, that your annotations will be included in the document content.

Syntax
'Declaration
 
Public Overloads Function SaveDocumentToJPEG( _
   ByVal FilePath As String, _
   ByVal Quality As Integer _
) As GdPictureStatus
public GdPictureStatus SaveDocumentToJPEG( 
   string FilePath,
   int Quality
)
public function SaveDocumentToJPEG( 
    FilePath: String;
    Quality: Integer
): GdPictureStatus; 
public function SaveDocumentToJPEG( 
   FilePath : String,
   Quality : int
) : GdPictureStatus;
public: GdPictureStatus SaveDocumentToJPEG( 
   string* FilePath,
   int Quality
) 
public:
GdPictureStatus SaveDocumentToJPEG( 
   String^ FilePath,
   int Quality
) 

Parameters

FilePath
The file path including the full document name, where the resulting JPEG file will be saved.
Quality
The compression quality level from 0 to 100 to be used to compress the resulting JPEG file. 0 means worse quality and better compression, 100 means the best quality and worse compression.

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.
Remarks

Just to remind you that if you want to permanently incorporate the annotations to be part of the document content, you need to use the BurnAnnotationsToPage(Boolean) method before saving the file.

Example
How to save your JPEG image displayed in the viewer.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("myimage.jpg") = GdPictureStatus.OK Then
    'Annotate your document.
    If GdViewer1.BurnAnnotationsToPage(True) = GdPictureStatus.OK Then
        If GdViewer1.SaveDocumentToJPEG("myimage.jpg", 75) = GdPictureStatus.OK Then
            MessageBox.Show("Done!", "GdViewer.SaveDocumentToJPEG")
        Else
            MessageBox.Show("The file can't be saved. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToJPEG")
        End If
    Else
        MessageBox.Show("Annotations can't be burned. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToJPEG")
    End If
Else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToJPEG")
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("myimage.jpg") == GdPictureStatus.OK)
{
    //Annotate your document.
    if (GdViewer1.BurnAnnotationsToPage(true) == GdPictureStatus.OK)
    {
        if (GdViewer1.SaveDocumentToJPEG("myimage.jpg", 75) == GdPictureStatus.OK)
            MessageBox.Show("Done!", "GdViewer.SaveDocumentToJPEG");
        else
            MessageBox.Show("The file can't be saved. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToJPEG");
    }
    else
        MessageBox.Show("Annotations can't be burned. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToJPEG");
}
else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToJPEG");
See Also