If I want to specifiy a specific font for some text does the font file need to be loaded and where? I’m generating the files on shared hosting server, so I don’t have access to any directories other than my hosting ones. I need to know the actual page count of the document (and table heights) so the code most need access to the font info. Also, I assume the fonts are need to saveas pdf. The documentation is light on this topic. (Or I could find it.)
Hi
Thanks for your request. I think, the information provided in the following thread could be useful for you:
https://docs.aspose.com/words/java/convert-a-document-to-pdf/
Unfortunately, currently there is no way to specify custom true type fonts directory. Your request has been linked to the appropriate issue. You will be notified as soon as this feature is available.
Best regards.
Is there any way to discover what fonts are installed that can be used? I’m running with a shared hosting fitm… so I can’t install anything. But I’d know what fonts are installed that I can use. If I try to use a font and it’s not installed do I get any feedback? (Also, can I assume that the “standard” fonts of Arial, Times and Verdana are always available?)
My hosting vendor (joe’s discount hosting), came back with the following code sample. If this runs, does it mean that I have access to the necessary directories and keys? If so, this would be a find list of fonts that I need…
You can list the fonts available by using the following code.
InstalledFontCollection insFont = new InstalledFontCollection();
FontFamily [] families = insFont.Families;
foreach (FontFamily family in families)
{
Response.Write (family.GetName(0) + "[b]");
}
List of fonts available are
Arial
Arial Black
Comic Sans MS
Courier New
Estrangelo Edessa
Franklin Gothic Medium
Gautami
Georgia
Impact
Latha
Lucida Console
Lucida Sans Unicode
Mangal
Marlett
Microsoft Sans Serif
MV Boli
Palatino Linotype
Raavi
Shruti
Sylfaen
Symbol
Tahoma
Times New Roman
Trebuchet MS
Tunga
Verdana
Webdings
Wingdings
I received the following answer from my hosting firm “Your application should have permission to read the windows fonts directory and registry if you setup your application to run in full trust.”
Looking at the hosting firm’s help file, I found the following tip…
The default ASP.NET Trust level is set to Medium.
In general, most applications should run fine under Medium Trust. If your application requires Full Trust, you can override the trust level at the application level by adding the following to your web.config file:
<configuration>
<system.web>
<trust level="Full" />
</system.web>
</configuration>
Is it really that easy?
Hi
Yes, you can use code like this. Also, you can read registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
You should also note, if Aspose.Words cannot find some font, it will use alternative font from fonts available on your PC.
Regarding configuring trust level, please see the following link:
https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/tkscy493(v=vs.100)
Hope this helps.
Best regards.
The issues you have found earlier (filed as 14051;10499) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(62)