Using Custom Fonts for PDF Conversion

I am providing Custom fonts while conversion (to pdf) using the following code:

 List<String> customFontDirectoryPathList = new ArrayList<>();
        customFontDirectoryPathList.add("/Users/TestFonts");

        ConverterSettings settings = new ConverterSettings();
        settings.setFontDirectories(customFontDirectoryPathList);

This works fine.
I wanted to understand if there is any way we can provide Font resources using steams. I found a class StreamFontResource, but, not sure of how to use it in this context. Any code snippet or Examples will be very helpful.

Thanks

Hi @kswati2206
In actual API version we have only font directories setup possibility.

1 Like

We are trying to evaluate if its supported to use any persistent volume’s directory path for the Font resources. Could you please share any examples/details if and how to achieve this with groupdocs pdf Conversion?

Can you please explain what do you mean?
By default, the GroupDocs Conversion checks system fonts.
For Linux system fonts are stored in /usr/local/share/fonts
For Windows c:\Windows\fonts

Please check this code snippet. Using Custom Fonts for PDF Conversion

I am using this to provide custom fonts directory for the conversion service. Here, in the settings.setFontDirectories(“”) can we use persistent volume’s folder path?

@kswati2206 yes, you can specify the persistence volume path.
But why you don’t want to use fonts installed in the container?

We have shared containers and the fonts are not. These fonts are going to be user specific. That’s why we cant install the fonts.

So please try to use persistence volumes paths