Forum How do I...?

Embedding fonts using the Java interface

redherring917
Hi there... new to Prince.

When converting from SVG to PDF via the Java interface, how do I ensure that Prince embeds all fonts? I've installed the required fonts on the server running Prince, and the "desktop app" conversion embeds them properly, but the Java interface call so far does not.

Thanks!
mikeday
Does it work if you run Prince from the command-line on the server? Calling it through the Java interface should not make a difference.
redherring917
Thanks for your reply. Yes, running Prince from the command-line does appear to embed fonts but calling it from the Java interface does not. I am puzzled why that would be the case. Any thoughts?
redherring917
P.S. Here is the bare bones code I'm currently using to call Prince, just to confirm.

<cfscript>
pr = CreateObject("java", "com.princexml.Prince");
pr.init("C:\Program Files (x86)\Prince\Engine\bin\prince.exe");
if (pr.Convert("myfile.svg", "myfile.pdf"))
WriteOutput("Successful");
else
WriteOutput("Unsuccessful");
</cfscript>
mikeday
That looks good. Is myfile.pdf being created? If not, you could try calling setLog to specify an output log file for error and warning messages.
redherring917
Yes, myfile.pdf is being created. It's just not embedding fonts as it should. I'll keep testing to make sure that I'm not fooling myself, but if you think of any reason that running Prince from the command line would embed fonts while running it from the Java interface would not, please let me know.
redherring917
OK. Weird...

As mentioned, running Prince via the command line does properly embed fonts. But, if I create a web page to execute Prince from the command line, (via ColdFusion's CFEXECUTE tag, but that shouldn't matter), fonts are NOT embedded. Same command run directly from the command line as called from the web page. Can you think of why this might be the case?

Thanks.
redherring917
This has been resolved. Necessary fonts are now spec'd in the stylesheet referenced by Prince, and thus are embedded properly in PDF output.

Thanks.