In This Topic
FlexViewer allows you to load the PDF files in the FlexViewer control using C1PDFDocumentSource class. ComponentOne Studio for WinForms includes a new component, C1PDFDocumentSource, which can open a PDF file and load it into the FlexViewer for viewing. The rendered PDF file can also be exported or printed, if need be.
Loading PDF files in FlexViewer control at design time
Perform the following steps to render a PDF file in FlexViewer control:
- Create a new WinForms application.
- Drag and drop C1PDFDocumentSource control on the form. It appears in the form's component tray.
- Navigate to the Toolbox, drag and drop C1FlexViewer control on the form. You can adjust the position and size of FlexViewer according to the requirement.
- In Properties Window, click the dropdown arrow next to DocumentSource property value field and select c1PDFDocumentSource1.
- Select C1PDFDocumentSource component and go to properties of c1PDFDocumentSource1 in Properties window. Locate DocumentLocation property and enter the full path of the PDF file you want to view.
- Run the application. The PDF is rendered in FlexViewer control.
Loading PDF files in FlexViewer control programmatically
Perform the following steps to render a PDF file in FlexViewer control programmatically:
- Drag and drop C1PDFDocumentSource and C1FlexViewer on the form.
- Double-click the form and write the following code in the Form1_Load event:
Furthermore, the following features are supported in the PDF files loaded in the FlexViewer control:
-
Text Search -
To search text in a PDF file, follow these steps:
- Load the PDF containing text in the FlexViewer control.
- Select Find option in the FlexViewer Ribbon.
- In the Find textbox that appears in Status bar, type the text you want to Search and press Enter.
-
Text Selection and copying text -
To select text in a PDF file, follow these steps:
- Load the PDF containing text in the FlexViewer control.
- Select Text Selection tool from the FlexViewer Ribbon.
- Select the text in the PDF.
- Copy the text using Keyboard keys,Ctrl+C, or ‘Copy Text’ option in FlexViewer Ribbon.