SaveDocumentToPDF(String) Method
In This Topic
Saves the document displayed in the GdViewer control to a file in PDF format according to a file path you have specified. The document 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, for example for printing or to disable their editing.
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
Parameters
- FilePath
- The file path including the full document name, where the resulting PDF document will be saved.
Use the ForceTemporaryMode property before loading if you want to overwrite the initial file.
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 save your PDF document displayed in the viewer.
'We assume that the GdViewer1 control has been properly integrated.
GdViewer1.ForceTemporaryMode = True
If GdViewer1.DisplayFromFile("mydocument.pdf") = GdPictureStatus.OK Then
'Annotate your document.
If GdViewer1.BurnAnnotationsToPage(True) = GdPictureStatus.OK Then
'The same file path is used.
If GdViewer1.SaveDocumentToPDF("mydocument.pdf") = GdPictureStatus.OK Then
MessageBox.Show("Done!", "GdViewer.SaveDocumentToPDF")
Else
MessageBox.Show("The file can't be saved. Status: " + GdViewer1.GetStat().ToString(), "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")
//We assume that the GdViewer1 control has been properly integrated.
GdViewer1.ForceTemporaryMode = true;
if (GdViewer1.DisplayFromFile("mydocument.pdf") == GdPictureStatus.OK)
{
//Annotate your document.
if (GdViewer1.BurnAnnotationsToPage(true) == GdPictureStatus.OK)
{
//The same file path is used.
if (GdViewer1.SaveDocumentToPDF("mydocument.pdf") == GdPictureStatus.OK)
MessageBox.Show("Done!", "GdViewer.SaveDocumentToPDF");
else
MessageBox.Show("The file can't be saved. Status: " + GdViewer1.GetStat().ToString(), "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");
Example
How to save your PDF document displayed in the viewer.
'We assume that the GdViewer1 control has been properly integrated.
GdViewer1.ForceTemporaryMode = True
If GdViewer1.DisplayFromFile("mydocument.pdf") = GdPictureStatus.OK Then
'Annotate your document.
If GdViewer1.BurnAnnotationsToPage(True) = GdPictureStatus.OK Then
'The same file path is used.
If GdViewer1.SaveDocumentToPDF("mydocument.pdf") = GdPictureStatus.OK Then
MessageBox.Show("Done!", "GdViewer.SaveDocumentToPDF")
Else
MessageBox.Show("The file can't be saved. Status: " + GdViewer1.GetStat().ToString(), "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")
//We assume that the GdViewer1 control has been properly integrated.
GdViewer1.ForceTemporaryMode = true;
if (GdViewer1.DisplayFromFile("mydocument.pdf") == GdPictureStatus.OK)
{
//Annotate your document.
if (GdViewer1.BurnAnnotationsToPage(true) == GdPictureStatus.OK)
{
//The same file path is used.
if (GdViewer1.SaveDocumentToPDF("mydocument.pdf") == GdPictureStatus.OK)
MessageBox.Show("Done!", "GdViewer.SaveDocumentToPDF");
else
MessageBox.Show("The file can't be saved. Status: " + GdViewer1.GetStat().ToString(), "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
BurnAnnotationsToPage(Boolean) Method
SavingProgress Event
ForceTemporaryMode Property
BurnAnnotationsToPage(Boolean) Method
SavingProgress Event
ForceTemporaryMode Property
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
BurnAnnotationsToPage(Boolean) Method
ForceTemporaryMode Property