Add and remove custom font for FreeText tool

Product: PDFTron

Product Version: 9.0.3-beta11
How I can add more font family for FreeText tool when select preset.

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi,

We’ve added API to add custom font for Free Text in the latest version (version 9.1.0) of the PDFTron Android library.

Specifically you can call the following ToolManagerBuilder API to use custom fonts stored in your Android assets folder:

ToolManagerBuilder toolManagerBuilder  = ToolManagerBuilder.from()
        .setFreeTextFontsFromAssets(new String[] {
                // Add custom fonts from assets which looks something like "file:///android_asset/..."
        });

Could you update to the latest PDFTron Android 9.1.0 version and give the above API a try?

It working, but when I can’t change style when choice Advanced Text format.
Video attach below.

Hi, that’s expected, because advanced text format has more style such as Bold/Italic/Undersline/Strikeout etc. To change style, the best way is to select the text and use the style picker icon from the horizontal style bar to change style, could you please give it a try?

it work and how to add custom font for Free Text and apply advanced text format for ios?
You can show me example to do that.
Thanks.

Hi,

You can set the font for a free text annotation directly using the following API:
-[PTFreeText setFontWithName:pdfDoc:].

For the user to select a font in the style picker, the font has to be installed on the device and your app will need the Font capability as described in Apple’s documentation here:
https://developer.apple.com/documentation/xcode/adding-capabilities-to-your-app

This setup guide from Apple explains the steps needed (as well as how to install custom fonts for your app):
https://help.apple.com/xcode/mac/current/#/dev06ad87885

Regarding rich text options (Bold/Italic/Underline etc). This is not currently supported on iOS but is under active development and we anticipate it being available in the near future.

You can get me example to can do it, thanks.

Hi,

Can you clarify in some more detail exactly what you are trying to do with FreeText?
Perhaps with a diagram explaining your requirements.

Specific is I want use custom font list when choice freetext like image attach.
Current in ios font list of freetext is font installed in device, how to disable it add jus use font of my added?

Please support to can do it.

Hi,

Showing a list of custom fonts only is not currently possible on iOS. One option would be for you to create your own picker populated with a list of your custom fonts. You could then show the picker and modify the text based on the user’s choice. Where in the UI are you hoping to show this picker from? We may need to expose some additional APIs if you are looking to replace the existing picker. Are you able to share some more detailed images showing the UI you’re trying to create?

I’m a little confused by the image you sent in your last message, where is this image from? It doesn’t appear to be using the PDFTron iOS SDK. Are you using the native iOS PDFTron SDK? Or are you using a framework such as Xamarin, React Native, or Flutter?

This image is a Website Use PDFTron but the picker had custom to display only my font, so in Mobile App I want to do like it because it is requirement of my project, I use framework React Native but I can’t see anywhere can do it.
With android Platform I can do but with IOS I can’t do it.
Here is Example in Android
Just setting with code:

ToolManagerBuilder toolManagerBuilder  = ToolManagerBuilder.from()
        .setFreeTextFontsFromAssets(new String[] {
                // Add custom fonts from assets which looks something like "file:///android_asset/..."
        });

With ios I cant see where can setting like this.

Anyone can help me this issues? Or any solution

Hello,

As Jamie mentioned, this is not currently supported. The SDK currently presents a UIFontPickerViewController which does not currently support filtering out arbitrary fonts.

If you are interested in writing your own font picker to replace the system one, that is certainly possible, although we may need to add some API hooks to allow you to present it instead of the system font picker. Is this something that interests you? If so, we can schedule in adding these hook. Please let us know.

Best Regards,
James Borthwick

Thanks for your response.
I’m looking forward to can implement this feature as quickly as possible.
Can you help me know how long to can take it?

Hello,

Yes, could you please submit your request using your business email using the following form?

Thank you,

James