Document Library for WinForms | ComponentOne
PdfDocumentSource / Load Document
In This Topic
    Load Document
    In This Topic

    PdfDocumentSource allows you to load a PDF document in FlexViewer using two methods, LoadFromFile and LoadFromStream, of C1PdfDocumentSource class. The LoadFromFile method loads the document from the source file and the LoadFromStream method loads the document from the source stream.

    Load from file

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

    C#
    Copy Code
    pdfDocSource.LoadFromFile(@"..\..\DefaultDocument.pdf");
    

    Load from stream

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

    C#
    Copy Code
    //Load report from stream
    Assembly asm = GetType().Assembly;
    using (Stream stream =
    asm.GetManifestResourceStream(@"LoadPDFfromStream.Resources.DefaultDocument.pdf"))
    c1PdfDocumentSource1.LoadFromStream(stream);
    

    Limitations of PdfDocumentSource

    Following are minor limitations of PdfDocumentSource: