DocumentConvertOptions.setUriExportStrategy controls the URIs written into the Markdown output for exported resources. This is useful when images are served from a CDN or a different path than where they’re saved.
Note
URI rewriting works with file-based image strategies (ExportImagesToFileSystemStrategy or CustomImagesStrategy). It has no effect when images are embedded as Base64, which is the default.
Default behaviour
Without an explicit strategy the library uses DefaultUriExportStrategy, which writes the relative path configured on the image strategy:
For most cases, setting setImagesRelativePath on the image strategy is all the URI control you need — see Save image as file.
Custom URI strategies
Warning
CustomUriExportStrategy cannot be used in 26.5. Its only public constructor takes com.groupdocs.markdown.uriexport.a — an obfuscated, package-private type — so it cannot be constructed from user code.
Implementing IUriExportStrategy yourself and passing it to setUriExportStrategy does work. A worked example will be published here once the constructor issue is resolved.
UriExportContext methods
IUriExportStrategy.updateResourceUri receives a UriExportContext:
Method
Description
getResourceFileName()
Default file name generated by the library
getResourceFileUri()
Default URI that would appear in the Markdown
setResourceFileName(String)
Override the resource file name
setResourceFileUri(String)
Override the URI written to the Markdown output
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.
On this page
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.