Show PDF documents, on Windows and Web pages. Maps the URLs to the source of the PDF, facilitating the visualization of online PDF files.
On this page:
Requirements
This component is Portable. It runs both on Windows (WPF) and on Web Pages hosted in any platform.
Configuration
- Go to Displays / Draw.
- On the Components Panel, select Viewer, then PdfViewer.
- Click or drag-and-drop it on the Drawing area to use it.
- Double-click the object to open the configuration window.
The only configuration required is to insert the URL in the URL field, which will map to the source of the PDF, facilitating the display of online PDF files.
Customization
Handling the URL via CodeBehind
To access the URL for PDF file on CodeBehind, use the LinkedValue
property. This property provides the URL associated with the control.
If the URL originates from a Tag, it will be tokenized. To retrieve the actual URL, use the following method:
string CustomUrl = T.Wpf.RunServices.ConfigHelper.UntokenizeObjectName(LinkedValue);
Method Replacement
The Validate()
method has been replaced by StartRuntime
for all controls, including TPdfViewer.
TPdfViewer pf = this.CurrentDisplay.GetControl("pd") as TPdfViewer; pf.Validate();
When initializing or updating a control, use StartRuntime()
instead of Validate:
TPdfViewer pf = this.CurrentDisplay.GetControl("pd") as TPdfViewer; pf.StartRuntime();
Runtime Execution
When running the application, the PdfViewer Control fetches and displays PDF documents from specified URLs. Upon execution, the PdfViewer Control accesses the provided URL and renders the PDF content within the application.
Running on Windows (Rich Clients)
The PdfViewer is able to access local files and files from the Web, according the URL.
Running on the browser (Web Clients)
The PdfViewer can only files from the Web, or from the Local WebServer (typically 127.0.0.1:3101 or 127.0.0.1:3103, according running the solution in Production or Development modes)
Example of URL acceptable for HTML5 Web Clients
http://localhost:65535/Resources/Document.pdf
In this section: