Inserting Html code with font-family not working on linux server

Hi team

I am using jdk8 and aspose v.20.4 I have a pdf where inserting html code on it. When I try to insert html code with font-family style(style=“font-family:Lucida Console”), it is not working on aws linux server. I have pasted some fonts from window to server.

See below fonts name that I have copied over there.

arialbd.ttf arialni.ttf calibrii.ttf comicbd.ttf courbi.ttf GARA.TTF impact.ttf times.ttf verdanab.ttf
arialbi.ttf arialn.ttf calibrili.ttf comici.ttf couri.ttf georgiab.ttf lucon.ttf trebucbd.ttf verdanai.ttf
ariali.ttf arial.ttf calibril.ttf comic.ttf cour.ttf georgiai.ttf timesbd.ttf trebucbi.ttf verdana.ttf
arialnbi.ttf ariblk.ttf calibri.ttf comicz.ttf GARABD.TTF georgia.ttf timesbi.ttf trebucit.ttf verdanaz.ttf
arialnb.ttf calibrib.ttf calibriz.ttf courbd.ttf GARAIT.TTF georgiaz.ttf timesi.ttf trebuc.ttf webdings.ttf

I have also configured the custom path of fonts on server when application starts.

FontRepository.setThreadStaticConfigEnabled(false)
FontRepository.addLocalFontPath("/opt/tomcat/font_files/fonts");

And It is taking that path after printing below logs

log.info "FontRepository.getLocalFontPaths() ${FontRepository.getLocalFontPaths()}"

When I try to do the SAME ON WIDNOW, it is working perfect.
Below is my sample code

String value = "<div><span style="font-size: 12px; font-family: &quot;Lucida Console&quot;;">We will require an initial fee of $1,700 to commence our representation Single Taxpayer Self-Employed case, and a current month representation fee of $0 (Waived). A monthly representation fee of $400 per month due the 1st day of each month until resolution is confirmed by the taxing authority. Payment is due in the month that resolution is confirmed. A $50 fee may apply for payments received </span><span style="font-size: 12px;"><span style="font-family: &quot;Lucida Console&quot;;">later than 5 days after the due date and for bounced checks</span>.</span></div><br><div><span style="font-size: 12px; font-family: &quot;Lucida Console&quot;;">Multi-Jurisdiction Representation - We will provide monthly representation with multiple taxing authorities.  This only includes the communication and review of correspondence from taxing authorities.  Taxing authority communication includes phone calls with taxing authorities and the client, review of correspondence/notices and counseling the client on related process and case recommendations.  Representation is limited to two taxing authorities unless otherwise stated in this</span><span style="font-size: 12px; font-family: &quot;Lucida Console&quot;;"> </span><span style="font-size: 12px; font-family: &quot;Lucida Console&quot;;">engagement letter.</span></div><br>"

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("path of pdf file");
HtmlFragment htmlFragment = new HtmlFragment(value);
double pdfcord = (double)(anyYCoordinatesHere)
double xAxisForHtml = (double)(anyXCoordinatesHere)
HtmlLoadOptions options = new HtmlLoadOptions();
options.setRenderToSinglePage(true);
htmlFragment.setHtmlLoadOptions(options)
float  width = 500 as float
float  height = 600 as float
FloatingBox box1 = new FloatingBox(width, height);
box1.setLeft(xAxisForHtml);
box1.setTop(pdfcord);
box1.getParagraphs().add(htmlFragment);
pdfPage.getParagraphs().add(box1);
pdfDocument.save("Path to save as PDF file here");

Can you please suggest me ?

@deepakblusynergy

Would you please try to place Lucida Console font as well inside the system and try again. Also, please try using Aspose.PDF for Java 20.11 and let us know if problem still persists by sharing complete error information along with Stack Trace. We will further proceed to assist you accordingly.

it is already in the custom path with name ‘lucon.ttf’. You can see in above list.

@deepakblusynergy

Would you please also share the information of error and stack trace with us. We will log an investigation ticket accordingly and share the ID with you.

there is no error in logs , but yes I can share pdf that used to generate the issue on both local and server.

original_file.pdf -> is file that we used on both system(local and server linux)
local_updated_file.pdf ->After inserting html code in file on local with font family
server_updated_file.pdf ->After inserting html code in file on server with font family

local_updated_file.pdf (58.4 KB)
original_file.pdf (8.1 KB)
server_updated_file.pdf (57.2 KB)

@deepakblusynergy

We have logged an investigation ticket as PDFJAVA-40002 in our issue tracking system for your case. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

any update on this ticket PDFJAVA-40002??

@Ashishb07

We are afraid that the earlier logged ticket could not get resolved due to other issues in the queue. Nevertheless, we will inform you as soon as the ticket is resolved or we have any information about its fix ETA. We apologize for the inconvenience.