GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / ForceTemporaryMode Property
Example





In This Topic
ForceTemporaryMode Property (GdViewer)
In This Topic
Forces the GdViewer control to use a temporary copy of the file when working (loading, displaying, saving) with your document.

Setting this property to true allows you to overwrite the displayed document, otherwise, the GdPictureStatus.AccessDenied status is returned when saving. Be sure to set this property to the required value before loading the document. Otherwise, it is not taking into account.

Syntax
'Declaration
 
Public Property ForceTemporaryMode As Boolean
public bool ForceTemporaryMode {get; set;}
public read-write property ForceTemporaryMode: Boolean; 
public function get,set ForceTemporaryMode : boolean
public: __property bool get_ForceTemporaryMode();
public: __property void set_ForceTemporaryMode( 
   bool value
);
public:
property bool ForceTemporaryMode {
   bool get();
   void set (    bool value);
}

Property Value

The default value is false.
Remarks
Please note that you need to set the required value before loading your document. For multi-page tiff files setting this property to true is necessary if you want to overwrite the loaded file.
Example
How to properly utilize the ForceTemporaryMode property.
'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.ForceTemporaryMode")
        Else
            MessageBox.Show("The file can't be saved. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.ForceTemporaryMode")
        End If
    Else
        MessageBox.Show("Annotations can't be burned. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.ForceTemporaryMode")
    End If
Else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.ForceTemporaryMode")
End If
//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.ForceTemporaryMode");
        else
            MessageBox.Show("The file can't be saved. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.ForceTemporaryMode");
    }
    else
        MessageBox.Show("Annotations can't be burned. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.ForceTemporaryMode");
}
else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.ForceTemporaryMode");
See Also