GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / DisplayFromHTTP Method / DisplayFromHTTP(String,String,String) Method
The full URI path with the full document name, where the file is located, for example http://guides.gdpicture.com/v14/pdf/GdPicture.NET14.pdf .
The login required to authenticate on the server. It can be an empty string.
The password required to authenticate on the server. It can be an empty string.
Example





In This Topic
DisplayFromHTTP(String,String,String) Method
In This Topic
Loads a document from a file stored on a distant server using HTTP transfer according to what you have specified and subsequently displays it in the GdViewer control. The file transfer will be run asynchronously. The document previously displayed in the control will automatically close.

All document formats currently supported by the toolkit are listed here.

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.

Syntax
'Declaration
 
Public Overloads Function DisplayFromHTTP( _
   ByVal Uri As String, _
   ByVal Login As String, _
   ByVal Password As String _
) As GdPictureStatus
public GdPictureStatus DisplayFromHTTP( 
   string Uri,
   string Login,
   string Password
)
public function DisplayFromHTTP( 
    Uri: String;
    Login: String;
    Password: String
): GdPictureStatus; 
public function DisplayFromHTTP( 
   Uri : String,
   Login : String,
   Password : String
) : GdPictureStatus;
public: GdPictureStatus DisplayFromHTTP( 
   string* Uri,
   string* Login,
   string* Password
) 
public:
GdPictureStatus DisplayFromHTTP( 
   String^ Uri,
   String^ Login,
   String^ Password
) 

Parameters

Uri
The full URI path with the full document name, where the file is located, for example http://guides.gdpicture.com/v14/pdf/GdPicture.NET14.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.

Remarks
Just to remind you that both the DataReceived event and the TransferEnded event are raised to allow you to monitor the transfer progress.

Likewise, you can also utilize both the BeforeDocumentChange and the AfterDocumentChange events using this method.

Example
How to display your image from a distant server using the HTTP transfer.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromHTTP("http://www.mywebsite.com/demo/image.tif", "login", "password") = GdPictureStatus.OK Then
    'Do your stuff here.
Else
    If GdViewer1.GetStat() = GdPictureStatus.InternetConnectError Then
        'Use the GetLastTransferError() method here to find the reason for the failure.
        MessageBox.Show("Internet connection error: " + GdViewer1.GetLastTransferError(), "GdViewer.DisplayFromHTTP")
    Else
        MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromHTTP")
    End If
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromHTTP("http://www.mywebsite.com/demo/image.tif", "login", "password") == GdPictureStatus.OK)
{
    //Do your stuff here.
}
else
{
    if (GdViewer1.GetStat() == GdPictureStatus.InternetConnectError)
        //Use the GetLastTransferError() method here to find the reason for the failure.
        MessageBox.Show("Internet connection error: " + GdViewer1.GetLastTransferError(), "GdViewer.DisplayFromHTTP");
    else
        MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromHTTP");
}
See Also