SaveDocumentToPDF(String,String,String) Method
In This Topic
Saves the document displayed in the GdViewer control to a file in PDF 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, therefore this method requires
Please consider using the BurnAnnotationsToPage(Boolean) method before saving, if you expect, that your annotations will be included in the document content, for example for printing or to disable their editing.
The DataReceived event is raised to allow you to monitor the transferred data. Likewise, the TransferEnded event is raised right after the transfer will finish. You can also control displaying the progress bar by enabling or disabling the EnabledProgressBar property.
The SavingProgress event is raised after each successfully saved page, when processing the image-based documents, in other words if you are saving the multi-page TIFF file to PDF document.
Syntax
'Declaration
Public Overloads Function SaveDocumentToPDF( _
ByVal As String, _
ByVal As String, _
ByVal As String _
) As GdPictureStatus
public GdPictureStatus SaveDocumentToPDF(
string ,
string ,
string
)
public function SaveDocumentToPDF(
: String;
: String;
: String
): GdPictureStatus;
public function SaveDocumentToPDF(
: String,
: String,
: String
) : GdPictureStatus;
public: GdPictureStatus SaveDocumentToPDF(
string* ,
string* ,
string*
)
public:
GdPictureStatus SaveDocumentToPDF(
String^ ,
String^ ,
String^
)
Parameters
- Uri
- The full URI path with the full document name, where the resulting PDF document will be saved,
for example ftp://ftp.gdpicture.com/upload/myfile.pdf or http://www.gdpicture.com/upload/myfile.pdf.
- 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.
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 GetLastTransferError method to diagnose the error if this method has failed with one of the GdPictureStatus.Internet... errors.
Example
How to save the file displayed in the viewer to the PDF document 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.SaveDocumentToPDF("ftp://ftp.myweb.com/upload/myfile.pdf", "login", "password") = GdPictureStatus.OK Then
MessageBox.Show("Done!", "GdViewer.SaveDocumentToPDF")
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.SaveDocumentToPDF")
End If
Else
MessageBox.Show("Annotations can't be burned. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToPDF")
End If
Else
MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToPDF")
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.SaveDocumentToPDF("ftp://ftp.myweb.com/upload/myfile.pdf", "login", "password") == GdPictureStatus.OK)
MessageBox.Show("Done!", "GdViewer.SaveDocumentToPDF");
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.SaveDocumentToPDF");
}
}
else
MessageBox.Show("Annotations can't be burned. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToPDF");
}
else
MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SaveDocumentToPDF");
See Also
Reference
GdViewer Class
GdViewer Members
Overload List
SaveDocumentToJPEG(String,Int32) Method
SaveDocumentToJPEG(Stream,Int32) Method
SaveDocumentToJPEG(String,String,String,Int32) Method
SaveDocumentToTIFF(String,TiffCompression) Method
SaveDocumentToTIFF(Stream,TiffCompression) Method
SaveDocumentToTIFF(String,String,String,TiffCompression) Method
SavingProgress Event
EnabledProgressBar Property
BurnAnnotationsToPage(Boolean) Method
GetLastTransferError Method