# Load PDF

## Content

PdfDocumentSource allows you to load a PDF in FlexViewer control using two methods, [LoadFromFile](/componentone/docs/wpf/online-document/) and [LoadFromStream](/componentone/docs/wpf/online-document/), of [C1PdfDocumentSource](/componentone/api/wpf/online-document/dotnet-framework-api/C1.WPF.Document.4.6.2/C1.WPF.Document.C1PdfDocumentSource.html) class. The **LoadFromFile** method loads PDF from the source file and the **LoadFromStream** method loads a PDf from source stream.

### To load PDF from file

The following code uses the **LoadFromFile** method to load a PDF from source file.

```vbnet
pds.LoadFromFile("..\..\DefaultDocument.pdf")
```

```csharp
pds.LoadFromFile(@"..\..\DefaultDocument.pdf");
```

### To load PDF from stream

The following code uses the **LoadFromStream** method to load a PDF from source stream.

```vbnet
Dim pds As New C1PdfDocumentSource()
'Load report from stream
Dim asm As Assembly = [GetType](/componentone/docs/wpf/online-document/PDFDocumentSource-for-WPF/Features/Load-PDF).Assembly
Using stream As Stream = asm.GetManifestResourceStream _
        ("PDFDocumentSource_LoadFromStream_VB.Resources.DefaultDocument.pdf")
  pds.LoadFromStream(stream)
End Using
```

```csharp
C1PdfDocumentSource pds = new C1PdfDocumentSource();
//Load report from stream
Assembly asm = GetType().Assembly;
using (Stream stream = asm.GetManifestResourceStream
  (@"PDFDocumentSource_LoadfromStream.Resources.DefaultDocument.pdf"))
    pds.LoadFromStream(stream);
```

## See Also

[Export PDF](/componentone/docs/wpf/online-document/PDFDocumentSource-for-WPF/Features/Export-PDF)
[Print PDF](/componentone/docs/wpf/online-document/PDFDocumentSource-for-WPF/Features/Print-PDF)
[Text Search](/componentone/docs/wpf/online-document/PDFDocumentSource-for-WPF/Features/Text-Search)