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: "Lucida Console";">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: "Lucida Console";">later than 5 days after the due date and for bounced checks</span>.</span></div><br><div><span style="font-size: 12px; font-family: "Lucida Console";">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: "Lucida Console";"> </span><span style="font-size: 12px; font-family: "Lucida Console";">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 ?