Skip to content

This example analyses fonts used in a document and loads them to the custom font collection.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/office-file-api-dx-font-repository

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Word Processing Document API – Detect and Download Fonts

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.

image

Implementation Details

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.

Files to Review

Build a Docker Image

Visual Studio

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.

CLI

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/.

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)