The following example detects and loads custom fonts used within a document. The application obtains a list of all fonts used in the document and loads them from the Google Fonts resource, when required. Loaded fonts are added to the DXFontRepository automatically and made available without additional installation requirements.
Note
Google Fonts are open-source, but read the license agreement to determine usage rights for your particular use case.
The application uses the DocumentIterator API to detect fonts used in a document loaded to the RichEditDocumentServer instance. The application lists them in a table. You can click Load From Google Fonts button for an individual font or click Load all Fonts from Google Fonts to download all.
The fonts are loaded from Google Fonts and added to the DXFontRepository. When all fonts are added to the font collection, click the Download as PDF button to open the resulting document in PDF format.
Important
The Universal Subscription or an additional Office File API Subscription is required to use this example in production code. For pricing information, please refer to the DevExpress Subscription page.
You can run the app on supported Windows platforms, Windows Subsystem for Linux or Docker. Select a platform from the debug drop-down in the toolbar, and start debugging the app.
Run the application from the dotnet CLI on Windows, Linux and MacOS with the dotnet run command. To run the Docker container from the command line, build the Docker image. You should pass the DevExpress NuGet source URL as a secret to restore NuGet packages. Use the following commands to build and run the docker image:
docker build -t officefontsapp.
docker run -d -p 8080:80 officefontsapp
The application page is available at the following URL: http://localhost:8080/.
(you will be redirected to DevExpress.com to submit your response)