Chromium Embedded Framework (CEF)
The Chromium Embedded Framework (CEF) is an open source framework used to embed the Chromium (Chrome) browser engine in other applications.
PSPDFKit for Windows Vista/7/8/8.1 via CEF
With CEF, PSPDFKit can be integrated into almost any desktop-style application on any OS, similar to Electron. The most common use case is integrating PSPDFKit into apps that are built with WIN32 or WPF instead of UWP.
CefSharp, a popular binding for CEF, supports Windows Vista, 7, 8, 8.1, and 10.
Using CEF with CefSharp on Windows
Support for CefSharp on Windows is currently in beta. Please contact us for a sample app.
The 7zip file provided contains a modified version of the official CefSharp minimal example solution. It’s a Git repository, and the last commit on master contains the complete changes necessary for using our SDK with CefSharp.
A scheme handler, which supplies the files requested by the CefSharp control, is registered for HTTP. This is just a very basic custom scheme handler to demonstrate how to handle requests, and it isn’t production-ready code. To fully implement a custom scheme handler, please consult the CefSharp documentation.
Running the Sample
To get the sample to run, do the following:
-
Unzip the minimal example project and open the solution contained within it.
-
Make sure
CefSharp.MinimalExample.Wpf
is the active project. -
Right-click on the project
CefSharp.MinimalExample.Wpf
and click Build. -
Start the project and it should display
default.pdf
in the app.
Adding the License Key
PSPDFKit is a commercial product and uses a license key to verify your copy against the package name you registered. Alternatively, you can initialize the SDK in trial mode without a license.
-
Unzip the minimal example project and open the solution contained within it.
-
Make sure
CefSharp.MinimalExample.Wpf
is the active project. -
In the Solution Explorer, open the file
CefSharp.MinimalExample.Wpf\Properties\assets\license
. -
Replace the
LICENSE_KEY_GOES_HERE
text with your license key. -
Open
CefSharp.MinimalExample.Wpf\CefSharpSchemeHandlerFactory.cs
and change thecef.example.com
string to match the bundle ID of your license. This is essential! -
Open
CefSharp.MinimalExample.Wpf\MainWindow.xaml
and change thecef.example.com
string to match your bundle ID. -
Right-click on the project
CefSharp.MinimalExample.Wpf
and click Build.
Troubleshooting
If the PDF isn’t displayed, you can troubleshoot the app while it’s running by opening a Chrome browser, navigating to http://localhost:8088/, and clicking on PSPDFKit for Web.
This will open a connection to the running app, and you can then switch to the Console tab of the developer tools and examine any error messages.