SaveDocumentToJPEG(String,String,String,Int32) Method
Saves the document displayed in the GdViewer control to a file in JPEG format on a distant server using HTTP or FTP transfer according to what you have specified. The file transfer will be run synchronously. The document is saved with full GdPicture/XMP annotation support.
Please consider using the GdViewer.BurnAnnotationsToPage method before saving, if you expect, that your annotations will be included in the document content.
The GdViewer.DataReceived event is raised to allow you to monitor the transferred data. Likewise, the GdViewer.TransferEnded event is raised right after the transfer will finish. You can also control displaying the progress bar by enabling or disabling the GdViewer.EnabledProgressBar property.
public GdPictureStatus SaveDocumentToJPEG(
string ,
string ,
string ,
int
)
public function SaveDocumentToJPEG(
: String;
: String;
: String;
: Integer
): GdPictureStatus;
public function SaveDocumentToJPEG(
: String,
: String,
: String,
: int
) : GdPictureStatus;
public: GdPictureStatus SaveDocumentToJPEG(
string* ,
string* ,
string* ,
int
)
public:
GdPictureStatus SaveDocumentToJPEG(
String^ ,
String^ ,
String^ ,
int
)
'Declaration
Public Overloads Function SaveDocumentToJPEG( _
ByVal As String, _
ByVal As String, _
ByVal As String, _
ByVal As Integer _
) As GdPictureStatus
Parameters
- Uri
- The full URI path with the full document name, where the resulting JPEG file will be saved, for example ftp://ftp.gdpicture.com/upload/myfile.jpg
or http://www.gdpicture.com/upload/myfile.jpg.
- Login
- The login required to authenticate on the server. It can be an empty string.
- Password
- The password required to authenticate on the server. It can be an empty string.
- 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.
Use the GdViewer.GetLastTransferError method to diagnose the error if this method has failed with one of the GdPictureStatus.Internet... errors.
How to save the file displayed in the viewer to the JPEG image on a distant server.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
'Annotate your document.
If GdViewer1.BurnAnnotationsToPage(True) = GdPictureStatus.OK Then
If GdViewer1.SaveDocumentToJPEG("ftp://ftp.myweb.com/upload/myimage.jpg", "login", "password", 75) = GdPictureStatus.OK Then
MessageBox.Show("Done!", "GdViewer.SaveDocumentToJPEG")
Else
Dim message As String = "The file can't be saved. Status: " + GdViewer1.GetStat().ToString() + vbCrLf
If (Not String.IsNullOrEmpty(GdViewer1.GetLastTransferError())) Then
message = message + " ftp failure: " + GdViewer1.GetLastTransferError()
End If
MessageBox.Show(message, "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")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
//Annotate your document.
if (GdViewer1.BurnAnnotationsToPage(true) == GdPictureStatus.OK)
{
if (GdViewer1.SaveDocumentToJPEG("ftp://ftp.myweb.com/upload/myimage.jpg", "login", "password", 75) == GdPictureStatus.OK)
MessageBox.Show("Done!", "GdViewer.SaveDocumentToJPEG");
else
{
string message = "The file can't be saved. Status: " + GdViewer1.GetStat().ToString() + "\n";
if (!String.IsNullOrEmpty(GdViewer1.GetLastTransferError()))
message = message + " ftp failure: " + GdViewer1.GetLastTransferError();
MessageBox.Show(message, "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");