External resources refer to various types of content or files that are not directly embedded within the document but are instead referenced and loaded from external locations. These resources enhance the functionality, appearance, and interactivity of the document. Common external resources include images, audio, video, fonts, CSS, scripts, frameworks, and so on. GroupDocs.Conversion considers external any resource that a document is trying to load from an external URL.
Utilizing external resources optimizes the performance, maintainability, and scalability of web pages and other documents. These resources are typically cached by browsers, which can reduce the load time of subsequent visits to a website. However, relying too heavily on external resources can also introduce dependencies and potential points of failure if the external sources become unavailable.
Sometimes you may want to skip loading most of the external resources, but still load some particular resources.
To allow-list specific resources during the conversion, use the WhitelistedResources property of the respective WebLoadOptions, PresentationLoadOptions, or WordProcessingLoadOptions class. The property is effective when the SkipExternalResources property is enabled. The WhitelistedResources property accepts the string list containing the portions of URLs to be loaded while restricting the loading of other external resources.
The following code snippet shows how to load the JPG and JPEG images and any resources from the example.com domain while restricting any other external resources: