Issues converting HTML/CSS to PDF

Here is a list of issues I have noticed while trying to convert HTML to PDF:

  1. Font family not consistent: Font family of HTML is different from font family in PDF

  2. Using , , or setting these font styles through css not being applied: When using those tags or applying those styles through css, they are not being applied properly when rendering the PDF. Ex: both are applied to some string, the PDF displays string with no styles.

  3. Overlapping text: This is inconsistent, but text on the same line will overlap each other.

  4. elements will overlap text: Any text within a tag will overlap other text in same line in the PDF.

  5. Padding-top not applied to header/footer: We have repeating headers and footers in the PDF for each page that is generated. Applying padding-top inline or through a css class does not how in the PDF. However, when I added a border, padding-top was applied. I don’t see why I would need to add a border just to get padding-top to show in the PDF.

  6. Alignment in repeating header/footer off: Certain styles are used to align text (ie text-align:center) and alignment is off.

@NicoleCote,

Kindly send us your source HTML document, code and highlight the issues with the help of snapshots. We will investigate and share our findings with you. Your response is awaited.

Below is one example payload for repeating headers to start with since it covers multiple issues. I will be getting another sample payload together. In the HTML below, we are using the “em” tag to make the title italic, but when the PDF is generated, the title is neither bold nor italic. Also, there is a “span” tag, where in the PDF, the text within that tag is overlapping other text. Lastly, both “h4” tags are contained within a div that has inline padding-top style, and in the PDF, it is not being applied.

<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<link href="//fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
	<style>
	.toggle-buttons .toggle-buttons--list .toggle-button { padding: 0.4667rem 0.8667rem; }.header { color: rgb(20, 80, 158); }#allcontent { font-family: "Open Sans" !important; }.modalDialog { position: fixed; font-family: Arial, Helvetica, sans-serif; top: 0px; right: 0px; bottom: 0px; left: 0px; background: rgba(0, 0, 0, 0.8); z-index: 99999; opacity: 0; transition: opacity 400ms ease-in; pointer-events: none; }.modalDialog:target { opacity: 1; pointer-events: auto; }.modalDialog > div { width: 400px; position: relative; margin: 10% auto; padding: 5px 20px 13px; border-radius: 10px; background: -webkit-linear-gradient(top, rgb(255, 255, 255), rgb(153, 153, 153)); }.close { background: rgb(96, 96, 97); color: rgb(255, 255, 255); line-height: 25px; position: absolute; right: -12px; text-align: center; top: -10px; width: 24px; text-decoration: none; font-weight: bold; border-radius: 12px; box-shadow: rgb(0, 0, 0) 1px 1px 3px; }.close:hover { background: rgb(0, 217, 255); }
	</style>
	<style>
	label { margin-right: 10px; }.footer-container { position: absolute; width: 100%; bottom: 0px; margin-top: 10px; }.content-wrapper { padding-bottom: 120px; }.wrapper { min-height: 100%; position: relative; }.attr-search { margin-top: 10px; padding-bottom: 5px; }.no-margin { margin: 0px; }.bottom-marg { margin-bottom: 15px; }.top-marg { margin-top: 15px; }.glyphicon-style { font-size: 25px; padding-bottom: 10px; color: rgb(51, 122, 183); cursor: pointer; }.styled-modal-header { background-color: rgb(64, 136, 0); }.error-modal-header { background-color: rgb(227, 227, 227); }.styled-modal-title { color: rgb(255, 255, 255); }.jqx-input { padding: 0px 1px !important; }.jqx-calendar-title-navigation.jqx-icon-arrow-right, .jqx-calendar-title-navigation.jqx-icon-arrow-left { height: 24px; }.jqx-icon-arrow-left, .jqx-icon-arrow-left-hover, .jqx-icon-arrow-left-selected, .jqx-icon-arrow-right, .jqx-icon-arrow-right-hover, .jqx-icon-arrow-right-selected { background-position: center center; }.jqx-grid-column-filterbutton { display: block; }.jqx-grid .jqx-widget-header, .jqx-grid-column-header, .jqx-widget-header { box-sizing: content-box; text-size-adjust: none; -webkit-background-clip: padding-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); border-color: rgb(204, 204, 204); background: linear-gradient(rgb(240, 240, 240) 0px, rgb(227, 227, 227) 100%) repeat-x; }.jqx-grid-column-header { font-size: 12px; color: rgb(102, 102, 102) !important; }div[id^="filterrow"] div div.jqx-grid-cell { background: rgb(254, 232, 190) !important; }div[id^="filterrow"] div div.jqx-grid-cell input { background: rgb(254, 232, 190); border-color: rgb(255, 212, 132); color: rgb(153, 153, 153); }div[id^="filterrow"] div div.jqx-grid-cell input:focus { background: rgb(255, 255, 255); border-color: rgb(153, 153, 153); color: rgb(51, 51, 51); }.jqx-widget-content { font-family: "MS Reference Sans Serif"; font-size: 12px; color: rgb(51, 51, 51); }.jqx-grid-cell { border-top: 0px solid transparent; border-left: 0px solid transparent; margin-right: 1px; margin-bottom: 1px; background: rgb(255, 255, 255); white-space: nowrap; font-weight: normal; font-size: 11px; line-height: 18px; overflow: hidden; height: 100%; border-right: 1px solid rgb(235, 235, 235) !important; border-bottom: 1px solid rgb(201, 201, 201) !important; position: absolute !important; }div.jqx-grid-content > div > div[role="row"]:nth-child(2n+1) > div.jqx-grid-cell:not(.jqx-grid-empty-cell).jqx-fill-state-hover, div[role="gridcell"].jqx-fill-state-hover { background: rgb(231, 240, 251); }div.jqx-grid-content > div > div[role="row"]:nth-child(2n+1) > div.jqx-grid-cell:not(.jqx-grid-empty-cell).jqx-fill-state-pressed, div[role="gridcell"].jqx-fill-state-pressed { background: rgb(231, 232, 236) !important; }div.jqx-grid-column-header > div > div > span { color: rgb(102, 102, 102); font-size: 11px; font-style: normal; font-weight: 700; padding-left: 8px; padding-right: 8px; }.grid-header { color: rgb(102, 102, 102); font-size: 11px; font-style: normal; font-weight: 700; margin-top: 5px; padding-left: 8px; padding-right: 8px; }.overlay { position: fixed; background: rgba(51, 51, 51, 0.4); top: 0px; right: 0px; bottom: 0px; left: 0px; z-index: 10000; }.loader { border-width: 7px; border-style: solid; border-color: rgb(52, 152, 219) rgb(243, 243, 243) rgb(243, 243, 243); border-image: initial; border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; display: block; z-index: 100000; position: absolute; top: 50%; left: 50%; }@-webkit-keyframes spin { 
	 0% { transform: rotate(0deg); }
	 100% { transform: rotate(360deg); }
	}@keyframes spin { 
	 0% { transform: rotate(0deg); }
	 100% { transform: rotate(360deg); }
	}.open > .dropdown-menu { width: 350px; }#value-table ul { overflow-x: auto !important; }#welcome { position: relative; height: 500px; }#welcome .well { padding: 50px; }.center { margin: 0px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }.form-horizontal .control-label { padding-top: 0px; margin: 0px 0px 10px; }.grid-icon { padding-top: 5px; padding-left: 40%; color: rgb(231, 76, 60); font-size: 14px !important; }.no-padding { padding-left: 0px; padding-right: 0px; }.text-right { text-align: right; }.text-left { text-align: left; }.text-capitalize { text-transform: capitalize; }.text-center { text-align: center; }.padding-left { padding-left: 15px; }.padding-right { padding-right: 15px !important; }.padding-bottom { padding-bottom: 10px !important; }.padding-top { padding-top: 15px !important; }.text-danger { color: rgb(231, 76, 60); }.float-right { float: right; }.word-overflow { word-wrap: break-word; }.centered { margin: 0px auto; }.modal { overflow-y: auto; }.modal-open { padding-right: 0px !important; }.table { font-size: 14px; }.th-style { color: rgb(102, 102, 102); background: linear-gradient(rgb(240, 240, 240) 0px, rgb(227, 227, 227) 100%); }.td-padding { padding: 8px; }.add-button { cursor: pointer; font-size: 32px; color: rgb(51, 122, 183); }#editModal table, #create table { margin: 0px auto; }.styled-well { border-left: 5px solid rgb(243, 156, 18); }#snapshot-editModal .modal-body, #snapshot-create .modal-body { padding: 15px 0px; }#title { text-align: left; }#login { text-align: right; margin: 10px; padding-right: 15px; color: rgb(255, 255, 255); font-size: 0.9em; }#login a { color: rgb(255, 255, 255); }#search_Class { margin-left: 30px; }#search_Fund { margin-left: 30px; }#input_Class { text-align: right; font-size: 0.9em; }#input_Fund { text-align: right; font-size: 0.9em; }#topnav { margin: 0rem; }#topnavcontainer { padding-left: 0px; padding-right: 0px; }#topnavtabs { text-align: center; }#topnavtabs li { display: table-cell; width: 20%; height: auto; vertical-align: bottom; border-top: 1px solid rgb(81, 115, 28); border-left: 1px solid rgb(81, 115, 28); border-right: 1px solid rgb(81, 115, 28); }#topnavtabs li.active a { background-color: rgb(148, 179, 44); border-color: transparent; }#topnavtabs li a:hover { background-color: rgb(148, 179, 44); border-color: transparent; }.topnavtab { background-color: rgb(64, 136, 0); color: white; border-radius: 0px; margin-right: 0px; padding: 2px; border: 1px solid rgb(86, 154, 19); display: block; position: relative; }.navtabs-item { display: table-cell; width: 20%; height: auto; vertical-align: bottom; border-top: 1px solid rgb(81, 115, 28); border-left: 1px solid rgb(81, 115, 28); border-right: 1px solid rgb(81, 115, 28); padding-left: 0px; padding-right: 0px; }.attr-tab-wrapper { float: left; margin-bottom: -1px; display: block; position: relative; }.activeTab { background-color: rgb(148, 179, 44); border-color: transparent; color: white; }.navSubTabs { margin-right: 2px; line-height: 1.42857; border: 1px solid transparent; border-radius: 4px 4px 0px 0px; padding: 10px 15px; display: block; }.activeSubTab { color: rgb(85, 85, 85); background-color: rgb(255, 255, 255); border-width: 1px; border-style: solid; border-color: rgb(221, 221, 221) rgb(221, 221, 221) transparent; border-image: initial; cursor: default; }#topnavtabs a.active { background-color: rgb(148, 179, 44); border-color: transparent; color: white; }#topnavtabs a:hover { background-color: rgb(148, 179, 44); border-color: transparent; color: white; }#topnavtabs a:focus { color: white; }#attrtabs, #grouptabs, #configtabs { margin-bottom: 0px; }.select-style { padding: 3px 0px 3px 1px; }#add-new-group, #apply, #sub-apply, #add-new-subgroup { float: right; }#add-new-group, #add-new-subgroup { margin-bottom: 15px; }#apply, #sub-apply { margin-top: 15px; }#fund-save, #class-save, #proforma-save { margin: 10px 0px; float: right; display: block; }#proforma-search { margin-top: 5px; display: block; float: right; }#fundError, #classError, #detailError { text-align: center; }#userMsg { color: red; text-align: center; }#portfolio-details .panel, #class-details .panel { border-radius: 0px; background-color: rgb(240, 240, 240); }#portfolio-details .panel-default { border-left: 5px solid rgb(230, 147, 46); }#class-details .panel-default { border-left: 5px solid rgb(99, 191, 127); }#contentattrFundGrid div[role="columnheader"]:first-child, #contentattrFundGrid div[role="columnheader"]:nth-child(2), #contentattrClassGrid div[role="columnheader"]:first-child, #contentattrClassGrid div[role="columnheader"]:nth-child(2) { background-color: rgb(238, 238, 238); }#save-exclusion { float: right; }#lipper-form { margin-top: 15px; }#lipper-form .well { border-left: 5px solid rgb(243, 156, 18); }#lipper-form select { padding: 3px 0px 3px 1px; }#add-exclusion { cursor: pointer; font-size: 32px; color: rgb(51, 122, 183); }#remove-exclusion { cursor: pointer; }#lipper-attribute, #lipper-operator, #lipper-value { cursor: pointer; }#attribute, #value { cursor: pointer; width: 270px; }#group-operator { cursor: pointer; width: 180px; }#saveExclusionModal .modal-header { background-color: rgb(64, 136, 0); }#saveExclusionModal .modal-title { color: rgb(255, 255, 255); }#saveExclusionModal span { cursor: pointer; }#group-execution-form { margin: 0px auto; width: 100%; }#group-execution-form select { width: 100%; }.set-background { background: rgba(51, 51, 51, 0.5); }#confirm-preview { float: left; }.formRequired { color: red; }#contract-types, #cycle-year, #snapshot-name { width: 70%; }.text-red { color: rgb(231, 76, 60) !important; }.text-green { color: rgb(39, 174, 96) !important; }#summary-sec, #quartile-sec { width: 33.3333%; }#aspg-sec { width: 50%; }#T11 caption, #T12 caption, #T13 caption { color: rgb(0, 0, 0); font-weight: bold; }.summary table, .quartile table, .reportBody table, #aspg table, #tabularBody table { width: 100%; font-size: 11px; }.summary table, .quartile table { border-style: none !important; }.summary td, .summary th, .quartile td, .quartile th { border-style: dashed !important; }.reportBody table { margin-top: 25px; }.reportBody tr td { color: rgb(41, 128, 185); }.reportBody table, .reportBody td, #aspg table, #aspg td { border-style: none !important; }.reportBody th, #aspg th { border-top-style: none; border-right-style: none; border-left-style: none; }.summary table, .summary th, .summary td, .quartile table, .quartile th, .quartile td, .reportBody table, .reportBody th, .reportBody td { border: 1px solid black; border-collapse: collapse; }.summary th, .summary td, .quartile th, .quartile td, .reportBody th, .reportBody td { padding: 3px 0px 3px 10px; }.reportBody table tr th { border-top: 0px; border-right: 0px; border-left: 0px; }.summary table tr:first-child th, .quartile table tr:first-child th { border-top: 0px; }.summary table tr:last-child td, .quartile table tr:last-child td { }.summary table tr td:first-child, .summary table tr th:first-child, .quartile table tr td:first-child, .quartile table tr th:first-child { border-left: 0px; border-top: 0px; }.summary table tr td:last-child, .summary table tr th:last-child, .quartile table tr td:last-child, .quartile table tr th:last-child { border-right: 0px; }.margin-top { margin-top: 5%; }#totalExpenseByClassBody tr td, #te-tabular .reportBody tr td, #mf-tabular .reportBody tr td { color: rgb(0, 0, 0) !important; }#footnoteText { font-size: 11px; }.textarea { width: 98%; resize: none; overflow: hidden; min-height: 50px; font-size: 11px; }#left, #right { display: inline-block; font-size: 24px; cursor: pointer; transition: 0.6s ease; }.slideshow-container { max-width: 1000px; position: relative; margin: auto; }.myContent { display: none; }.fade-content { animation-name: fade; animation-duration: 0.5s; }@-webkit-keyframes fade-content { 
	 0% { opacity: 0.4; }
	 100% { opacity: 1; }
	}@keyframes fade-content { 
	 0% { opacity: 0.4; }
	 100% { opacity: 1; }
	}.show-content { display: block; }#config { font-size: 24px; cursor: pointer; }#tabularBody th, #tabularBody td { padding: 2px 0px; }#footer { width: 100%; }.symbol-padding-left { padding-left: 3px; }.symbol-padding-right { padding-right: 3px; }.showRow { display: block; }.hideRow { display: none; }.show-bottom-border { border-bottom: 1px solid rgb(0, 0, 0); vertical-align: bottom; }.jqx-button.jqx-fill-state-normal, .jqx-button.jqx-fill-state-hover { color: rgb(231, 76, 60); font-weight: bold; }#sortOrder-input { width: 50px; }#description-input { width: 100%; }.disable-button { pointer-events: none; opacity: 0.65; }span.disabled-button:hover { cursor: not-allowed; }.thick-border { border-left: 5px solid !important; border-right: 5px solid !important; }.border-bottom { border-bottom-width: medium; border-bottom-style: solid !important; }.no-bottom-border { border-bottom: none !important; border-right: 1px solid !important; border-left: 1px solid !important; border-top: 1px solid !important; }.no-border { border: none !important; }.large-padding-left { padding-left: 30px !important; }.align-bottom { vertical-align: bottom; }.extra-padding-left { padding-left: 42px; }.tabular-container { max-width: 1400px; position: relative; margin: auto; font-size: 11px; }#mappedGroupCodes { max-width: 1200px; margin: 0px auto; border: 2px solid; padding: 15px; }.display-inline { display: inline-block; }#footer hr { margin: 0px; border-top: 1px solid rgb(0, 0, 0); }#footer p { margin: 0px; font-style: italic; }.highlight { background: rgb(189, 195, 199); }.bold { font-weight: bold; }.italic { font-style: italic; }.page-break { break-after: page; }.status-box { height: 150px; width: 80%; margin: 0px auto; box-shadow: rgba(0, 0, 0, 0.5) 0px 5px 15px; }.complete-box { border: 1px solid rgb(39, 174, 96); }.in-progress-box { border: 1px solid rgb(41, 128, 185); }.error-box { border: 1px solid rgb(192, 57, 43); }.status-header { padding: 15px; }.complete-header { background: rgb(39, 174, 96); }.in-progress-header { background: rgb(41, 128, 185); }.error-header { background: rgb(192, 57, 43); }.status-title { margin: 0px; line-height: 1.42857; color: rgb(245, 245, 245); }.status-body { position: relative; height: 98.6px; }.top-margin { margin-top: 20px; }.in-process { color: rgb(41, 128, 185); }.complete { color: rgb(39, 174, 96); }.hide-text { display: none; }.disable-nav { pointer-events: none; cursor: default; }.disable-nav .topnavtab { background: rgba(51, 51, 51, 0.3); }.ellipsis-anim span { opacity: 0; animation: ellipsis-dot 1.35s infinite; }.ellipsis-anim span:nth-child(1) { animation-delay: 0s; }.ellipsis-anim span:nth-child(2) { animation-delay: 0.1s; }.ellipsis-anim span:nth-child(3) { animation-delay: 0.2s; }.ellipsis-anim span:nth-child(4) { animation-delay: 0.3s; }@-webkit-keyframes ellipsis-dot { 
	 0% { opacity: 0; }
	 50% { opacity: 1; }
	 100% { opacity: 0; }
	}@keyframes ellipsis-dot { 
	 0% { opacity: 0; }
	 50% { opacity: 1; }
	 100% { opacity: 0; }
	}hr { margin-top: 20px; margin-bottom: 20px; border-top: 1px solid rgb(238, 238, 238); }caption { padding-top: 8px; padding-bottom: 8px; }h4 { font-size: 18px; }h5 { font-size: 14px; }h6 { font-size: 11px; margin-top: 0px !important; margin-bottom: 0px !important; }.fidelity-theme h6 { font-size: 11px !important; }h4, h5 { margin-top: 10px; margin-bottom: 10px; }p { margin: 0px 0px 10px; }.excel-btn { background: url("../img/excel.gif") center center no-repeat rgb(245, 245, 245); width: 26px; height: 26px; }@media (max-width: 992px) {
	 #snapshot-editModal .modal-body { text-align: center; }
	 #snapshot-editModal table { margin: 0px auto; }
	}
	</style>
	<style type="text/css">
	@page {size: 11.7in 8.3in;margin:1in;}table {-fs-table-paginate: paginate;border-spacing: 0;}
	</style>
	<title></title>
</head>
<body>
	<div style="padding-top:15px">
		<h4 class="text-capitalize"><em>fixed income and asset allocation fund board <!--template bindings={
  "ng-reflect-ng-if": "true"
}--><span>- AA</span></em></h4><!--template bindings={
  "ng-reflect-ng-if": "<h4><em>Summary of 2016&nbsp;Bond Fund Total Expenses, Performance and Profitability Nicole&#39;s Title</em></h4>\n"
}--><span></span>
		<h4><span><em>Summary of 2016&nbsp;Bond Fund Total Expenses, Performance and Profitability Nicole's Title</em></span></h4>
	</div>
</body>
</html>

Here is an image of what the header looks like in the generated PDF.header.PNG (14.2 KB)

@NicoleCote,

We have converted your HTML document to PDF with the latest version 17.10 of Aspose.Pdf for .NET API and the output PDF looks fine. This is the output PDF: output17.10.pdf (27.6 KB). If you find any issue, then please highlight with the help of the snapshot.

This is the process we are using for creating headers and footers for PDFs:

For the repeating headers and footers, we create an HTMLFragment object that takes the HTML String in its constructor. Then the HTMLFragment is put inside a Paragraph which is added to a HeaderFooter object. The HeaderFooter object is then set as the header or footer respectively as shown below:

pdf.getPages().forEach(pdfPage -> {
                    HtmlFragment htmlHeader = null;
                    if(singleReportRequest.getHeader() != null ) {
                           htmlHeader = new HtmlFragment(singleReportRequest.getHeader());
                           htmlHeader.setHorizontalAlignment(HorizontalAlignment.Center);
                           htmlHeader.setZIndex(-1000);
                    }
                    HtmlFragment htmlFooter = null;
                    if(singleReportRequest.getFooter() != null ) {
                           htmlFooter = new HtmlFragment(singleReportRequest.getFooter());
                           htmlFooter.setHorizontalAlignment(HorizontalAlignment.Center);
                           htmlFooter.setVerticalAlignment(VerticalAlignment.Bottom);
                           htmlFooter.setZIndex(-1000);
                    }
                    
                    if (htmlHeader != null) {
                           HeaderFooter h = new HeaderFooter();
                           Paragraphs p = new Paragraphs();
                           p.add(htmlHeader);
                           h.setParagraphs(p);
                           pdfPage.setHeader(h);
                    }
                    if (htmlFooter != null) {
                           HeaderFooter f = new HeaderFooter();
                           Paragraphs p = new Paragraphs();
                           p.add(htmlFooter);
                           f.setParagraphs(p);
                           pdfPage.setFooter(f);
                    }
             });

Are we implementing this correctly? If not, could you please let us know how this should be implemented to allow a header with bold and italic styling.

@NicoleCote,

We have added header and footer in the same way as you are adding, and it adds text with bold and italic formatting. This is the output PDF file: output17.10.pdf (29.6 KB)

[Java]

// Instantiate Document object
Document doc = new Document();
// add a page to pages collection of PDF file
page = doc.getPages().add();
// Instantiate HtmlFragment with HTML contents
String text = new String(Files.readAllBytes(Paths.get("C:\\Pdf\\test449\\input.html")));
HtmlFragment htmlHeader = new HtmlFragment(text);
htmlHeader.setHorizontalAlignment(HorizontalAlignment.Center);
htmlHeader.setZIndex(-1000);
        
HtmlFragment htmlFooter = new HtmlFragment(text);
htmlFooter.setHorizontalAlignment(HorizontalAlignment.Center);
htmlFooter.setVerticalAlignment(VerticalAlignment.Bottom);
htmlFooter.setZIndex(-1000);
        
HeaderFooter h = new HeaderFooter();
Paragraphs p = new Paragraphs();
p.add(htmlHeader);
h.setParagraphs(p);
page.setHeader(h);        

HeaderFooter f = new HeaderFooter();
Paragraphs paras = new Paragraphs();
paras.add(htmlFooter);
f.setParagraphs(paras);
page.setFooter(f);
// Save PDF file
doc.save("C:\\Pdf\\test449\\output17.10.pdf");

How are you encoding the html? We are using encodeURI from JavaScript. We were previously using encodeURIComponent, but one of the reports that needs to be converted to PDF uses various html entities for symbols (ex: @, +, *, dagger, lozenge), and with encodeURIComponent, they were not displaying properly in the PDF.

@NicoleCote,

It is the internal API implementation and we do not disclose this. However, if you are facing any problematic behavior, then please share details. We will investigate appropriately and share our findings with you.

We sorted through encoding, and things are working fine now. There is one thing that we are wondering about is the font size shrinking. For example, in the html, we have defined the font-size to be 11px, but when the PDF is generated, it becomes 8.5. Is there a way to control the font-size in the PDF?

@sourabhroy,

The TextState member of the HTML fragment allows to set the font size. In the above use case, we could not find the font difference. However, if you can see a difference, then please highlight the target string with the help of a snapshot. We will investigate and share our findings with you. Your response is awaited.

My team member will be looking into adding the TextState. If we have any issues, I will get back with samples.

There is a different error we have been running into. We are using version 16.12.0. This error is not consistent, but here is the logged error we are seeing:

<pre>org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.aspose.pdf.internal.p644.z16
       org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1303)
       org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:977)
       org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
       org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
       org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
       org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
       org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
       com.fimt.asts.frf.threadmonitor.ServletThreadMonitorFilter.doFilter(ServletThreadMonitorFilter.java:37)
       org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
       org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
       org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
       org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
       org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
       org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
       org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
       org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
       org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
       org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
       org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
       org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
       org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
       org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
       org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:94)
       org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
       org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
       org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
       org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
       org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
       org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
       org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
       org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
       org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
       org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
       com.fimt.asts.ntlm.jcif.filter.FimtNtlmHttpFilter.doFilter(FimtNtlmHttpFilter.java:117)
       com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:156)
       com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:233)

root cause

java.lang.NoClassDefFoundError: Could not initialize class com.aspose.pdf.internal.p644.z16
           com.aspose.pdf.internal.p318.z11.m1(Unknown Source)
           com.aspose.pdf.internal.p318.z11.m1(Unknown Source)
           com.aspose.pdf.internal.p318.z8.m1(Unknown Source)
           com.aspose.pdf.internal.p318.z10.m1(Unknown Source)
           com.aspose.pdf.internal.p318.z10.m1(Unknown Source)
           com.aspose.pdf.internal.p318.z10.m1(Unknown Source)
           com.aspose.pdf.internal.p374.z2.m1(Unknown Source)
           com.aspose.pdf.internal.p373.z10.m1(Unknown Source)
           com.aspose.pdf.internal.p393.z3.m1(Unknown Source)
           com.aspose.pdf.internal.p329.z32.<init>(Unknown Source)
           com.aspose.pdf.internal.p329.z5.m1(Unknown Source)
           com.aspose.pdf.internal.p329.z5.<init>(Unknown Source)
           com.aspose.pdf.internal.p392.z21.m1(Unknown Source)
           com.aspose.pdf.internal.p361.z13.<init>(Unknown Source)
           com.aspose.pdf.internal.p328.z4.m4(Unknown Source)
           com.aspose.pdf.internal.p328.z4.<init>(Unknown Source)
           com.aspose.pdf.internal.p328.z5.m1(Unknown Source)
           com.aspose.pdf.internal.p363.z2.<init>(Unknown Source)
           com.aspose.pdf.internal.p328.z3.m1(Unknown Source)
           com.aspose.pdf.internal.p396.z1.m1(Unknown Source)
           com.aspose.pdf.internal.p396.z1.m1(Unknown Source)
           com.aspose.pdf.z90.m1(Unknown Source)
           com.aspose.pdf.ADocument.m1(Unknown Source)
           com.aspose.pdf.ADocument.<init>(Unknown Source)
           com.aspose.pdf.Document.<init>(Unknown Source)
           com.fmrco.fees.generators.pdf.PdfAsposeGenerator.run(PdfAsposeGenerator.java:106)
           com.fmrco.mdmbf.restapi.service.PdfCreationServiceImpl.createPdfAspose(PdfCreationServiceImpl.java:35)
           com.fmrco.mdmbf.restapi.service.ReportServiceImpl.createSingleReportAspose(ReportServiceImpl.java:26)
           com.fmrco.mdmbf.restapi.controller.ReportController.createSingleReportAspose(ReportController.java:80)
           sun.reflect.GeneratedMethodAccessor1824.invoke(Unknown Source)
           sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           java.lang.reflect.Method.invoke(Method.java:497)
           org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
           org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
           org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
           org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
           org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
           org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
           org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
           org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
           org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
           org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
           org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
           org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
           com.fimt.asts.frf.threadmonitor.ServletThreadMonitorFilter.doFilter(ServletThreadMonitorFilter.java:37)
           org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
           org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
           org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
           org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
           org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
           org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
           org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
           org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
           org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
           org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
           org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
           org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
           org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
           org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
           org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:94)
           org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
           org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
           org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
           org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
           org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
           org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
           org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
           org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
           org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
           org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
           com.fimt.asts.ntlm.jcif.filter.FimtNtlmHttpFilter.doFilter(FimtNtlmHttpFilter.java:117)
           com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:156)
           com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:233)

@sourabhroy,

Kindly share all details of the scenario, including code and source documents, so that we could replicate this error in our environment. We will investigate and share our findings with you.

<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
	<meta charset="UTF-8">
	<link href="//fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
	<style>
	.toggle-buttons .toggle-buttons--list .toggle-button { padding: 0.4667rem 0.8667rem; }.header { color: rgb(20, 80, 158); }#allcontent { font-family: "Open Sans" !important; }.modalDialog { position: fixed; font-family: Arial, Helvetica, sans-serif; top: 0px; right: 0px; bottom: 0px; left: 0px; background: rgba(0, 0, 0, 0.8); z-index: 99999; opacity: 0; transition: opacity 400ms ease-in; pointer-events: none; }.modalDialog:target { opacity: 1; pointer-events: auto; }.modalDialog > div { width: 400px; position: relative; margin: 10% auto; padding: 5px 20px 13px; border-radius: 10px; background: -webkit-linear-gradient(top, rgb(255, 255, 255), rgb(153, 153, 153)); }.close { background: rgb(96, 96, 97); color: rgb(255, 255, 255); line-height: 25px; position: absolute; right: -12px; text-align: center; top: -10px; width: 24px; text-decoration: none; font-weight: bold; border-radius: 12px; box-shadow: rgb(0, 0, 0) 1px 1px 3px; }.close:hover { background: rgb(0, 217, 255); }
	</style>
	<style>
	label { margin-right: 10px; }.footer-container { position: absolute; width: 100%; bottom: 0px; margin-top: 10px; }.content-wrapper { padding-bottom: 120px; }.wrapper { min-height: 100%; position: relative; }.attr-search { margin-top: 10px; padding-bottom: 5px; }.no-margin { margin: 0px; }.bottom-marg { margin-bottom: 15px; }.top-marg { margin-top: 15px; }.glyphicon-style { font-size: 25px; padding-bottom: 10px; color: rgb(51, 122, 183); cursor: pointer; }.styled-modal-header { background-color: rgb(64, 136, 0); }.error-modal-header { background-color: rgb(227, 227, 227); }.styled-modal-title { color: rgb(255, 255, 255); }.jqx-input { padding: 0px 1px !important; }.jqx-calendar-title-navigation.jqx-icon-arrow-right, .jqx-calendar-title-navigation.jqx-icon-arrow-left { height: 24px; }.jqx-icon-arrow-left, .jqx-icon-arrow-left-hover, .jqx-icon-arrow-left-selected, .jqx-icon-arrow-right, .jqx-icon-arrow-right-hover, .jqx-icon-arrow-right-selected { background-position: center center; }.jqx-grid-column-filterbutton { display: block; }.jqx-grid .jqx-widget-header, .jqx-grid-column-header, .jqx-widget-header { box-sizing: content-box; text-size-adjust: none; -webkit-background-clip: padding-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); border-color: rgb(204, 204, 204); background: linear-gradient(rgb(240, 240, 240) 0px, rgb(227, 227, 227) 100%) repeat-x; }.jqx-grid-column-header { font-size: 12px; color: rgb(102, 102, 102) !important; }div[id^="filterrow"] div div.jqx-grid-cell { background: rgb(254, 232, 190) !important; }div[id^="filterrow"] div div.jqx-grid-cell input { background: rgb(254, 232, 190); border-color: rgb(255, 212, 132); color: rgb(153, 153, 153); }div[id^="filterrow"] div div.jqx-grid-cell input:focus { background: rgb(255, 255, 255); border-color: rgb(153, 153, 153); color: rgb(51, 51, 51); }.jqx-widget-content { font-family: "MS Reference Sans Serif"; font-size: 12px; color: rgb(51, 51, 51); }.jqx-grid-cell { border-top: 0px solid transparent; border-left: 0px solid transparent; margin-right: 1px; margin-bottom: 1px; background: rgb(255, 255, 255); white-space: nowrap; font-weight: normal; font-size: 11px; line-height: 18px; overflow: hidden; height: 100%; border-right: 1px solid rgb(235, 235, 235) !important; border-bottom: 1px solid rgb(201, 201, 201) !important; position: absolute !important; }div.jqx-grid-content > div > div[role="row"]:nth-child(2n+1) > div.jqx-grid-cell:not(.jqx-grid-empty-cell).jqx-fill-state-hover, div[role="gridcell"].jqx-fill-state-hover { background: rgb(231, 240, 251); }div.jqx-grid-content > div > div[role="row"]:nth-child(2n+1) > div.jqx-grid-cell:not(.jqx-grid-empty-cell).jqx-fill-state-pressed, div[role="gridcell"].jqx-fill-state-pressed { background: rgb(231, 232, 236) !important; }div.jqx-grid-column-header > div > div > span { color: rgb(102, 102, 102); font-size: 11px; font-style: normal; font-weight: 700; padding-left: 8px; padding-right: 8px; }.grid-header { color: rgb(102, 102, 102); font-size: 11px; font-style: normal; font-weight: 700; margin-top: 5px; padding-left: 8px; padding-right: 8px; }.overlay { position: fixed; background: rgba(51, 51, 51, 0.4); top: 0px; right: 0px; bottom: 0px; left: 0px; z-index: 10000; }.loader { border-width: 7px; border-style: solid; border-color: rgb(52, 152, 219) rgb(243, 243, 243) rgb(243, 243, 243); border-image: initial; border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; display: block; z-index: 100000; position: absolute; top: 50%; left: 50%; }@-webkit-keyframes spin { 
	 0% { transform: rotate(0deg); }
	 100% { transform: rotate(360deg); }
	}@keyframes spin { 
	 0% { transform: rotate(0deg); }
	 100% { transform: rotate(360deg); }
	}.open > .dropdown-menu { width: 350px; }#value-table ul { overflow-x: auto !important; }#welcome { position: relative; height: 500px; }#welcome .well { padding: 50px; }.center { margin: 0px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }.form-horizontal .control-label { padding-top: 0px; margin: 0px 0px 10px; }.grid-icon { padding-top: 5px; padding-left: 40%; color: rgb(231, 76, 60); font-size: 14px !important; }.no-padding { padding-left: 0px; padding-right: 0px; }.text-right { text-align: right; }.text-left { text-align: left; }.text-capitalize { text-transform: capitalize; }.text-center { text-align: center; }.padding-left { padding-left: 15px; }.padding-right { padding-right: 15px !important; }.padding-bottom { padding-bottom: 10px !important; }.padding-top { padding-top: 15px !important; }.text-danger { color: rgb(231, 76, 60); }.float-right { float: right; }.word-overflow { word-wrap: break-word; }.centered { margin: 0px auto; }.modal { overflow-y: auto; }.modal-open { padding-right: 0px !important; }.table { font-size: 14px; }.th-style { color: rgb(102, 102, 102); background: linear-gradient(rgb(240, 240, 240) 0px, rgb(227, 227, 227) 100%); }.td-padding { padding: 8px; }.add-button { cursor: pointer; font-size: 32px; color: rgb(51, 122, 183); }#editModal table, #create table { margin: 0px auto; }.styled-well { border-left: 5px solid rgb(243, 156, 18); }#snapshot-editModal .modal-body, #snapshot-create .modal-body { padding: 15px 0px; }#title { text-align: left; }#login { text-align: right; margin: 10px; padding-right: 15px; color: rgb(255, 255, 255); font-size: 0.9em; }#login a { color: rgb(255, 255, 255); }#search_Class { margin-left: 30px; }#search_Fund { margin-left: 30px; }#input_Class { text-align: right; font-size: 0.9em; }#input_Fund { text-align: right; font-size: 0.9em; }#topnav { margin: 0rem; }#topnavcontainer { padding-left: 0px; padding-right: 0px; }#topnavtabs { text-align: center; }#topnavtabs li { display: table-cell; width: 20%; height: auto; vertical-align: bottom; border-top: 1px solid rgb(81, 115, 28); border-left: 1px solid rgb(81, 115, 28); border-right: 1px solid rgb(81, 115, 28); }#topnavtabs li.active a { background-color: rgb(148, 179, 44); border-color: transparent; }#topnavtabs li a:hover { background-color: rgb(148, 179, 44); border-color: transparent; }.topnavtab { background-color: rgb(64, 136, 0); color: white; border-radius: 0px; margin-right: 0px; padding: 2px; border: 1px solid rgb(86, 154, 19); display: block; position: relative; }.navtabs-item { display: table-cell; width: 20%; height: auto; vertical-align: bottom; border-top: 1px solid rgb(81, 115, 28); border-left: 1px solid rgb(81, 115, 28); border-right: 1px solid rgb(81, 115, 28); padding-left: 0px; padding-right: 0px; }.attr-tab-wrapper { float: left; margin-bottom: -1px; display: block; position: relative; }.activeTab { background-color: rgb(148, 179, 44); border-color: transparent; color: white; }.navSubTabs { margin-right: 2px; line-height: 1.42857; border: 1px solid transparent; border-radius: 4px 4px 0px 0px; padding: 10px 15px; display: block; }.activeSubTab { color: rgb(85, 85, 85); background-color: rgb(255, 255, 255); border-width: 1px; border-style: solid; border-color: rgb(221, 221, 221) rgb(221, 221, 221) transparent; border-image: initial; cursor: default; }#topnavtabs a.active { background-color: rgb(148, 179, 44); border-color: transparent; color: white; }#topnavtabs a:hover { background-color: rgb(148, 179, 44); border-color: transparent; color: white; }#topnavtabs a:focus { color: white; }#attrtabs, #grouptabs, #configtabs { margin-bottom: 0px; }.select-style { padding: 3px 0px 3px 1px; }#add-new-group, #apply, #sub-apply, #add-new-subgroup { float: right; }#add-new-group, #add-new-subgroup { margin-bottom: 15px; }#apply, #sub-apply { margin-top: 15px; }#fund-save, #class-save, #proforma-save { margin: 10px 0px; float: right; display: block; }#proforma-search { margin-top: 5px; display: block; float: right; }#fundError, #classError, #detailError { text-align: center; }#userMsg { color: red; text-align: center; }#portfolio-details .panel, #class-details .panel { border-radius: 0px; background-color: rgb(240, 240, 240); }#portfolio-details .panel-default { border-left: 5px solid rgb(230, 147, 46); }#class-details .panel-default { border-left: 5px solid rgb(99, 191, 127); }#contentattrFundGrid div[role="columnheader"]:first-child, #contentattrFundGrid div[role="columnheader"]:nth-child(2), #contentattrClassGrid div[role="columnheader"]:first-child, #contentattrClassGrid div[role="columnheader"]:nth-child(2) { background-color: rgb(238, 238, 238); }#save-exclusion { float: right; }#lipper-form { margin-top: 15px; }#lipper-form .well { border-left: 5px solid rgb(243, 156, 18); }#lipper-form select { padding: 3px 0px 3px 1px; }#add-exclusion { cursor: pointer; font-size: 32px; color: rgb(51, 122, 183); }#remove-exclusion { cursor: pointer; }#lipper-attribute, #lipper-operator, #lipper-value { cursor: pointer; }#attribute, #value { cursor: pointer; width: 270px; }#group-operator { cursor: pointer; width: 180px; }#saveExclusionModal .modal-header { background-color: rgb(64, 136, 0); }#saveExclusionModal .modal-title { color: rgb(255, 255, 255); }#saveExclusionModal span { cursor: pointer; }#group-execution-form { margin: 0px auto; width: 100%; }#group-execution-form select { width: 100%; }.set-background { background: rgba(51, 51, 51, 0.5); }#confirm-preview { float: left; }.formRequired { color: red; }#contract-types, #cycle-year, #snapshot-name { width: 70%; }.text-red { color: rgb(231, 76, 60) !important; }.text-green { color: rgb(39, 174, 96) !important; }#summary-sec, #quartile-sec { width: 33.3333%; }#aspg-sec { width: 50%; }#T11 caption, #T12 caption, #T13 caption { color: rgb(0, 0, 0); font-weight: bold; }.summary table, .quartile table, .reportBody table, #aspg table { width: 100%; font-size: 11px; }#tabularBody table { width: 100%; font-size: 12px; }.summary table, .quartile table { border-style: none !important; }.summary td, .summary th, .quartile td, .quartile th { border-style: dashed !important; }.reportBody table { margin-top: 25px; }.reportBody tr td { color: rgb(41, 128, 185); }.reportBody table, .reportBody td, #aspg table, #aspg td { border-style: none !important; }.reportBody th, #aspg th { border-top-style: none; border-right-style: none; border-left-style: none; }.summary table, .summary th, .summary td, .quartile table, .quartile th, .quartile td, .reportBody table, .reportBody th, .reportBody td { border: 1px solid black; border-collapse: collapse; }.summary th, .summary td, .quartile th, .quartile td, .reportBody th, .reportBody td { padding: 3px 0px 3px 10px; }.reportBody table tr th { border-top: 0px; border-right: 0px; border-left: 0px; }.summary table tr:first-child th, .quartile table tr:first-child th { border-top: 0px; }.summary table tr:last-child td, .quartile table tr:last-child td { }.summary table tr td:first-child, .summary table tr th:first-child, .quartile table tr td:first-child, .quartile table tr th:first-child { border-left: 0px; border-top: 0px; }.summary table tr td:last-child, .summary table tr th:last-child, .quartile table tr td:last-child, .quartile table tr th:last-child { border-right: 0px; }.margin-top { margin-top: 5%; }#dto-title { border: 1px solid rgb(255, 255, 255); padding-top: 15px; }#totalExpenseByClassBody tr td, #te-tabular .reportBody tr td, #mf-tabular .reportBody tr td { color: rgb(0, 0, 0) !important; }#footnoteText { font-size: 11px; }.textarea { width: 98%; resize: none; overflow: hidden; min-height: 50px; font-size: 11px; }#left, #right { display: inline-block; font-size: 24px; cursor: pointer; transition: 0.6s ease; }.slideshow-container { max-width: 1000px; position: relative; margin: auto; }.myContent { display: none; }.fade-content { animation-name: fade; animation-duration: 0.5s; }@-webkit-keyframes fade-content { 
	 0% { opacity: 0.4; }
	 100% { opacity: 1; }
	}@keyframes fade-content { 
	 0% { opacity: 0.4; }
	 100% { opacity: 1; }
	}.show-content { display: block; }#config { font-size: 24px; cursor: pointer; }#tabularBody th { padding: 2px 5px; }#tabularBody td, #mappedGroupCodes td, #footnotes td { padding: 2px; }#footer { width: 100%; border: 1px solid rgb(255, 255, 255); padding-top: 20px; }.underline-text { border-bottom: 1px solid; }.assets-style, .mgmt-style { margin-left: 20px; padding-right: 20px; }.atm-style { margin-left: 16px; padding-right: 16px; }.te-style { margin-left: 22px; padding-right: 22px; }.benchmark-style { margin-left: 10px; padding-right: 10px; }.right-table { float: right; width: 50%; display: block; }.right-table-margin-top { margin-top: -112px; }.symbol-padding-left { padding-left: 3px; }.symbol-padding-right { padding-right: 3px; }.breakout-padding-left { padding-left: 10px; }.showRow { display: block; }.hideRow { display: none; }.show-bottom-border { border-bottom: 1px solid rgb(0, 0, 0); vertical-align: bottom; }.jqx-button.jqx-fill-state-normal, .jqx-button.jqx-fill-state-hover { color: rgb(231, 76, 60); font-weight: bold; }#sortOrder-input { width: 50px; }#description-input { width: 100%; }.disable-button { pointer-events: none; opacity: 0.65; }span.disabled-button:hover { cursor: not-allowed; }.thick-border { border-left: 5px solid !important; border-right: 5px solid !important; }.border-bottom { border-bottom-width: medium; border-bottom-style: solid !important; }.no-bottom-border { border-bottom: none !important; border-right: 1px solid !important; border-left: 1px solid !important; border-top: 1px solid !important; }.no-border { border: none !important; }.large-padding-left { padding-left: 30px !important; }.align-bottom { vertical-align: bottom; }.extra-padding-left { padding-left: 42px; }.tabular-container { max-width: 1300px; position: relative; margin: auto; font-size: 12px; }.mf-tabular-container { max-width: 1115px; position: relative; margin: auto; font-size: 12px; }.mf-tabular-container-eq { max-width: 1135px; position: relative; margin: auto; font-size: 12px; }.mf-tabular-container-large { max-width: 1375px; position: relative; margin: auto; font-size: 12px; }#mappedGroupCodes { max-width: 1200px; margin: 0px auto; border: 2px solid; padding: 15px; }.display-inline { display: inline-block; }#footer hr { margin: 0px; border-top: 1px solid rgb(0, 0, 0); }#footer p { margin: 0px; font-style: italic; }.highlight { background: rgb(189, 195, 199); }.bold { font-weight: bold; }.italic { font-style: italic; }.extra-padding-top { padding-top: 30px; }.box { border: 1px solid rgb(255, 255, 255); }.page-break { break-after: page; }.page-break-auto { break-after: auto; }.control-page-break { break-before: auto; }.no-page-break-inside { break-inside: avoid; }.status-box { height: 150px; width: 80%; margin: 0px auto; box-shadow: rgba(0, 0, 0, 0.5) 0px 5px 15px; }.complete-box { border: 1px solid rgb(39, 174, 96); }.in-progress-box { border: 1px solid rgb(41, 128, 185); }.error-box { border: 1px solid rgb(192, 57, 43); }.status-header { padding: 15px; }.complete-header { background: rgb(39, 174, 96); }.in-progress-header { background: rgb(41, 128, 185); }.error-header { background: rgb(192, 57, 43); }.status-title { margin: 0px; line-height: 1.42857; color: rgb(245, 245, 245); }.status-body { position: relative; height: 98.6px; }.top-margin { margin-top: 20px; }.in-process { color: rgb(41, 128, 185); }.complete { color: rgb(39, 174, 96); }.hide-text { display: none; }.disable-nav { pointer-events: none; cursor: default; }.disable-nav .topnavtab { background: rgba(51, 51, 51, 0.3); }.ellipsis-anim span { opacity: 0; animation: ellipsis-dot 1.35s infinite; }.ellipsis-anim span:nth-child(1) { animation-delay: 0s; }.ellipsis-anim span:nth-child(2) { animation-delay: 0.1s; }.ellipsis-anim span:nth-child(3) { animation-delay: 0.2s; }.ellipsis-anim span:nth-child(4) { animation-delay: 0.3s; }@-webkit-keyframes ellipsis-dot { 
	 0% { opacity: 0; }
	 50% { opacity: 1; }
	 100% { opacity: 0; }
	}@keyframes ellipsis-dot { 
	 0% { opacity: 0; }
	 50% { opacity: 1; }
	 100% { opacity: 0; }
	}hr { margin-top: 20px; margin-bottom: 20px; border-top: 1px solid rgb(238, 238, 238); }caption { padding-top: 8px; padding-bottom: 8px; }h4 { font-size: 18px; }h5 { font-size: 14px; }h6 { font-size: 12px; margin-top: 0px !important; margin-bottom: 0px !important; }.fidelity-theme h6 { font-size: 12px !important; }h4, h5 { margin-top: 10px; margin-bottom: 10px; }p { margin: 0px 0px 10px; }.col-md-6 { width: 50%; }*, ::after, ::before { box-sizing: border-box; }body { font-family: Arial, Helvetica, sans-serif; }.excel-btn { background: url("../img/excel.gif") center center no-repeat rgb(245, 245, 245); width: 26px; height: 26px; }@media (max-width: 992px) {
	 #snapshot-editModal .modal-body { text-align: center; }
	 #snapshot-editModal table { margin: 0px auto; }
	}
	</style>
	<style type="text/css">
	@page {size: 11.7in 8.3in;margin:1in;}table {-fs-table-paginate: paginate;border-spacing: 0;}
	</style>
	<div class="tabular-container" id="te-tabular" style="margin: 0 auto">
		<!--template bindings={
  "ng-reflect-ng-for-of": "[object Object]"
}--><!--template bindings={}-->
		<div class="page-break-auto" id="tabularBody">
			<div class="row">
				<div class="col-md-12">
					<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
					<table class="bottom-marg">
						<thead>
							<tr>
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
							</tr>
							<tr class="align-bottom">
								<th class="text-left" colspan="4">Mapped Group</th>
								<th class="text-center" colspan="4"><span class="avgAssets underline-text">Average Assets ($M)</span></th>
								<th colspan="2"></th>
								<th class="no-bottom-border text-center" colspan="8">Total Expenses (after Reimbursement)<span class="te-lozenge">◊</span><br>
								<span class="te underline-text">vs. Funds w/ Same Load Type</span></th>
								<th class="text-center" colspan="4" style="width:120px;">Cumulative % pt. Return over/(under) <span class="benchmark underline-text">Benchmark</span></th><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
							</tr>
							<tr>
								<th class="show-bottom-border" style="width:20px;"></th>
								<th class="show-bottom-border text-left" style="width:325px;">Fund</th><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th class="show-bottom-border" colspan="2" style="width: 140px;">Load Type</th><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th class="show-bottom-border text-center" colspan="2" style="width: 95px;">Fund Level</th><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th class="show-bottom-border text-center" colspan="2" style="width: 95px;">Class Level</th><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th class="show-bottom-border text-center" colspan="2" style="width:80px;">Mgmt<br>
								Fees†<br>
								(bp)</th><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th class="show-bottom-border text-center" colspan="2" style="width:80px;">Fid<br>
								(bp)</th><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th class="show-bottom-border text-center" colspan="2" style="width:80px;">Median<br>
								(bp)</th><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th class="show-bottom-border text-center" colspan="2" style="width:80px;">Var<br>
								(bp)</th><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th class="show-bottom-border text-center" colspan="2" style="width:80px;">%ile</th><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th class="show-bottom-border text-center" colspan="2" style="width:60px;">1-Year</th><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th class="show-bottom-border text-center" colspan="2" style="width:60px;">3-Year</th><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th class="show-bottom-border text-center" colspan="2" style="width:110px;">After Tax<br>
								Margin<!--template bindings={
  "ng-reflect-ng-if": "true"
}--> <span class="three-star">***</span><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></th>
							</tr>
						</thead><!--template bindings={
  "ng-reflect-ng-for-of": "[object Object]"
}-->
						<tbody>
							<tr>
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th class="text-left bold no-border" colspan="2" style="width: 345px;">
									<h6><em>Institutional</em></h6>
								</th><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th style="width: 20px;"></th><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th style="width: 120px;"></th><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<th style="width: 75px;"></th>
								<th style="width: 20px;"></th>
								<th style="width: 75px;"></th>
								<th style="width: 20px;"></th>
								<th style="width: 60px;"></th>
								<th style="width: 20px;"></th>
								<th style="width: 60px;border-left: 3px solid;border-right: none;border-bottom: none;"></th>
								<th style="width: 20px;border-left: none;border-right: 3px solid;border-bottom: none;"></th>
								<th style="width: 60px;"></th>
								<th style="width: 20px;"></th>
								<th style="width: 60px;"></th>
								<th style="width: 20px;"></th>
								<th style="width: 60px;"></th>
								<th style="width: 20px;"></th>
								<th style="width: 40px;"></th>
								<th style="width: 20px;"></th>
								<th style="width: 40px;"></th>
								<th style="width: 20px;"></th><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th style="width: 90px;"></th><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<th style="width: 20px;"></th>
							</tr><!--template bindings={
  "ng-reflect-ng-for-of": "[object Object]"
}-->
							<tr>
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="width:20px;"><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="text-align:left;width:325px;">Government</td><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td>Load</td><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="text-align:right;">5,047.1</td><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="text-align:right;">5,047.1</td><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="text-align:right;"><!--template bindings={
  "ng-reflect-ng-if": "true"
}--><span>20</span> <!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="text-align:right;border-left: 3px solid !important;border-right: none !important;"><!--template bindings={
  "ng-reflect-ng-if": "true"
}--><span>28</span> <!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="text-align:right;border-left: none !important;border-right: 3px solid !important;"><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="text-align:center;">18</td><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="text-align:right;">10</td><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="text-align:right;padding-right:10px;">72%</td><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="text-align:right;padding-right:10px;">0.3%</td><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="text-align:right;padding-right:10px;">0.4%</td><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}--><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td style="text-align:right;padding-right:10px;">-</td><!--template bindings={
  "ng-reflect-ng-if": "true"
}-->
								<td><!--template bindings={
  "ng-reflect-ng-if": "false"
}--></td><!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
								<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
							</tr>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<div style="page-break-inside: avoid;">
			<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
			<!--template bindings={
  "ng-reflect-ng-if": "false"
}-->
		</div>
	</div>
</body>
</html>

Here is the java code we are using to create the PDFs (we are using java version 1.8.45):

package com.fmrco.fees.generators.pdf;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Enumeration;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;

import com.aspose.pdf.Document;
import com.aspose.pdf.FolderFontSource;
import com.aspose.pdf.Font;
import com.aspose.pdf.FontRepository;
import com.aspose.pdf.FontStyles;
import com.aspose.pdf.HeaderFooter;
import com.aspose.pdf.HorizontalAlignment;
import com.aspose.pdf.HtmlFragment;
import com.aspose.pdf.HtmlLoadOptions;
import com.aspose.pdf.LoadOptions;
import com.aspose.pdf.MarginInfo;
import com.aspose.pdf.Page;
import com.aspose.pdf.PageInfo;
import com.aspose.pdf.PageSize;
import com.aspose.pdf.Paragraphs;
import com.aspose.pdf.PdfPageStamp;
import com.aspose.pdf.SaveFormat;
import com.aspose.pdf.Stamp;
import com.aspose.pdf.TextStamp;
import com.aspose.pdf.VerticalAlignment;
import com.aspose.pdf.facades.FormattedText;
import com.aspose.pdf.internal.ms.System.Uri;
import com.aspose.pdf.internal.ms.System.Net.NetworkCredential;
import com.aspose.pdf.internal.ms.System.Net.z89;
import com.aspose.pdf.text.CustomFontSubstitutionBase;
import com.aspose.pdf.text.SubstitutionFontCategories;
import com.aspose.pdf.text.SystemFontsSubstitution;
import com.fmrco.fees.entities.SingleReportRequest;

@Component(value = "pdfAsposeGenerator")
public class PdfAsposeGenerator extends BasePdfGenerator {
	
	private static Logger logger = LogManager.getLogger(PdfAsposeGenerator.class);
	
	
	private static final int DEFAULT_DPI = 72;
	private static final int CLIENT_DPI = 96;
	private static final int DEFAULT_MARGIN = 10;
	private static final String FONT_NAME = "Arial";
	
	private static final String STATIC_FILES_PATH = "/static";
	
	private SingleReportRequest singleReportRequest;
	
	public void setSingleReportRequest(SingleReportRequest singleReportRequest) {
		this.singleReportRequest = singleReportRequest;
	}
	
	@Override
	public void run() {
		com.aspose.pdf.License license = new com.aspose.pdf.License();
		try {
			logger.info("Path: " + this.getClass().getResource(STATIC_FILES_PATH + "/fonts").getPath());
			license.setLicense(this.getClass().getResourceAsStream(STATIC_FILES_PATH + "/licenses/Aspose.Pdf.lic"));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions(this.getClass().getResource(STATIC_FILES_PATH).getPath());
		
		double margin = singleReportRequest.getMargin() == null ? DEFAULT_MARGIN : singleReportRequest.getMargin();
		
		PageInfo pageInfo = new PageInfo();
		
		if(singleReportRequest.getLandscape() == null) {
			pageInfo.setHeight(singleReportRequest.getHeight());
			pageInfo.setWidth(singleReportRequest.getWidth());
		} else {
			pageInfo.setHeight(PageSize.getA4().getHeight());
			pageInfo.setWidth(PageSize.getA4().getWidth());
			if(singleReportRequest.getLandscape().equals("Y")) {
				pageInfo.setLandscape(true);
			} else {
				pageInfo.setLandscape(false);
			}
		}
		
		pageInfo.setMargin(new MarginInfo(margin, margin, margin, margin));
		htmlLoadOptions.setPageInfo(pageInfo);
		htmlLoadOptions.setInputEncoding("UTF-8");
		
		FontRepository.getSources().add(new FolderFontSource(this.getClass().getResource(STATIC_FILES_PATH + "/fonts").getPath()));
		
		SystemFontsSubstitution systemFontsSubstitution = new SystemFontsSubstitution(SubstitutionFontCategories.AllEmbeddedFonts);
		systemFontsSubstitution.setDefaultFont(FontRepository.findFont(FONT_NAME, true));
		FontRepository.getSubstitutions().add(systemFontsSubstitution);
		
		//FontRepository.setReplaceNotFoundFonts(true);
		FontRepository.loadFonts();
		
		Document pdf = new Document(new ByteArrayInputStream(singleReportRequest.getHtml().getBytes()), htmlLoadOptions);
		
		pdf.FontSubstitution.add(new Document.FontSubstitutionHandler() {
			public void invoke(Font font, Font newFont) {
				// print substituted FontNames into console
				System.out.println("Warning: Font " + font.getFontName() + " was substituted with another font -> " + newFont.getFontName());
			}
		});
		
		pdf.getPages().forEach(pdfPage -> {
			HtmlFragment htmlHeader = null;
			if(singleReportRequest.getHeader() != null ) {
				htmlHeader = new HtmlFragment(singleReportRequest.getHeader());
				htmlHeader.setHorizontalAlignment(HorizontalAlignment.Center);
				htmlHeader.setZIndex(-1000);
			}
			HtmlFragment htmlFooter = null;
			if(singleReportRequest.getFooter() != null ) {
				htmlFooter = new HtmlFragment(singleReportRequest.getFooter());
				htmlFooter.setHorizontalAlignment(HorizontalAlignment.Center);
				htmlFooter.setVerticalAlignment(VerticalAlignment.Bottom);
				htmlFooter.setZIndex(-1000);
			}
			
			if (htmlHeader != null) {
				HeaderFooter h = new HeaderFooter();
				Paragraphs p = new Paragraphs();
				p.add(htmlHeader);
				h.setParagraphs(p);
				pdfPage.setHeader(h);
			}
			if (htmlFooter != null) {
				HeaderFooter f = new HeaderFooter();
				Paragraphs p = new Paragraphs();
				p.add(htmlFooter);
				f.setParagraphs(p);
				pdfPage.setFooter(f);
			}
			
			if(singleReportRequest.getPage_numbers() != null) {
				if(singleReportRequest.getPage_numbers().equals("Y")) {
					TextStamp t = new TextStamp(pdfPage.getNumber() + " of " + pdf.getPages().size());
					t.setVerticalAlignment(VerticalAlignment.Bottom);
					t.setHorizontalAlignment(HorizontalAlignment.Center);
					pdfPage.addStamp(t);
				}
			}
			
			if (pdfPage.getResources().getFonts() != null) {
				for (com.aspose.pdf.Font pageFont : (Iterable<com.aspose.pdf.Font>) pdfPage.getResources().getFonts()) {
					logger.info(pageFont.getFontName() + " pageFont.isEmbedded() " + pageFont.isEmbedded());
					// Check if font is already embedded
					if (!pageFont.isEmbedded())
						pageFont.setEmbedded(true);
				}
			}
		});
		
		pdf.save(outputStream, SaveFormat.Pdf);
		logger.debug("end aspose pdf generator");
	}
	
}

Below is a more detailed error that has been logged:


root cause


class com.aspose.pdf.internal.ms.System.z9: Font ‘Arial’ does not support style ‘Regular’
com.aspose.pdf.internal.p644.z15.m1(Unknown Source)
com.aspose.pdf.internal.p644.z15.m1(Unknown Source)
com.aspose.pdf.internal.p644.z16.m3(Unknown Source)
com.aspose.pdf.internal.p644.z16.<clinit>(Unknown Source)
com.aspose.pdf.internal.p318.z11.m1(Unknown Source)
com.aspose.pdf.internal.p318.z11.m1(Unknown Source)
com.aspose.pdf.internal.p318.z8.m1(Unknown Source)
com.aspose.pdf.internal.p318.z10.m1(Unknown Source)
com.aspose.pdf.internal.p318.z10.m1(Unknown Source)
com.aspose.pdf.internal.p318.z10.m1(Unknown Source)
com.aspose.pdf.internal.p374.z2.m1(Unknown Source)
com.aspose.pdf.internal.p373.z10.m1(Unknown Source)
com.aspose.pdf.internal.p393.z3.m1(Unknown Source)
com.aspose.pdf.internal.p329.z32.<init>(Unknown Source)
com.aspose.pdf.internal.p329.z5.m1(Unknown Source)
com.aspose.pdf.internal.p329.z5.<init>(Unknown Source)
com.aspose.pdf.internal.p392.z21.m1(Unknown Source)
com.aspose.pdf.internal.p361.z13.<init>(Unknown Source)
com.aspose.pdf.internal.p328.z4.m4(Unknown Source)
com.aspose.pdf.internal.p328.z4.<init>(Unknown Source)
com.aspose.pdf.internal.p328.z5.m1(Unknown Source)
com.aspose.pdf.internal.p363.z2.<init>(Unknown Source)
com.aspose.pdf.internal.p328.z3.m1(Unknown Source)
com.aspose.pdf.internal.p396.z1.m1(Unknown Source)
com.aspose.pdf.internal.p396.z1.m1(Unknown Source)
com.aspose.pdf.z90.m1(Unknown Source)
com.aspose.pdf.ADocument.m1(Unknown Source)
com.aspose.pdf.ADocument.<init>(Unknown Source)
com.aspose.pdf.Document.<init>(Unknown Source)
com.fmrco.fees.generators.pdf.PdfAsposeGenerator.run(PdfAsposeGenerator.java:110)…

This seems to only occur in our upper environments, which is running on two servers. Our lower environments, it hasn’t been an issue, and these are running on one server.

@NicoleCote,

Your code is not in fully compilable form and has the reference of unknown packages. Kindly review and simplify the code, and then send again. We will investigate and share our findings with you.

@imran.rafique,

Hello, I’ve been working with Nicole to debug this issue. It seems that we are getting an error with the font:

class com.aspose.pdf.internal.ms.System.z9: Font ‘Arial’ does not support style 'Regular’

Do you have an example for how we can use a font (not included by default in aspose sush as Arial) in a newly created pdf? Currently we are storing the ttf files in a resources folder in our java project and that resource folder to the font repository as such:

FontRepository.getSources().add(new FolderFontSource(this.getClass().getResource(STATIC_FILES_PATH + "/fonts").getPath()));

Best,
Derrick

Also, the code works perfectly fine when we remove the Arial font from our resources folder so I don’t see how we could be referencing unknown packages. We have OpenSans stored in the same folder and that works fine. Whenever we include the Arial font files this line fails with the exception seen above:

Document pdf = new Document(new ByteArrayInputStream(singleReportRequest.getHtml().getBytes()), htmlLoadOptions);

@dhargwood,

You can specify the custom font directory and need to add a folder in font folder lists as follows:

[Java]

String path = "path/to/my/folder";
List<String> fontPaths = com.aspose.pdf.Document.getLocalFontPaths();
fontPaths.add(path);
com.aspose.pdf.Document.setLocalFontPaths(fontPaths);

Kindly let us know which JDK version you are using and how that code goes into your environment.

Hi,
Are there any further update on this issue.class com.aspose.pdf.internal.ms.System.z9: Font ‘Arial’ does not support style 'Regular’ ?Any workaround solutions?

@rhustead,

Please download and install the Microsoft core fonts RPM package. It appears as the Arial Regular font is missing on the machine. Please refer to this help topic: Install Microsoft TrueType Fonts in CentOS 6 / RHEL 6