Commit 26b9b179 by Nilu

Adding fonts for PDF generation

parent 892b7918
......@@ -2,6 +2,7 @@ package performa.utils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import oneit.appservices.config.ConfigMgr;
......@@ -12,13 +13,21 @@ import oneit.logging.LoggingArea;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.jsp.DocumentTag;
import oneit.utils.BusinessException;
import oneit.utils.CollectionUtils;
import oneit.utils.NestedException;
public class PDFUtils
{
public static final String FILE_BASE_PATH = ConfigMgr.getConfigString("CONFIG.GLOBAL", "PDFBaseLocation");
private static final String FONT_PATH = ConfigMgr.getConfigString("CONFIG.GLOBAL", "DocumentFontPath");
private static Collection documentFonts = CollectionUtils.listEntry(FONT_PATH + "Usual-Bold.ttf")
.listEntry(FONT_PATH + "Usual-Light.ttf")
.listEntry(FONT_PATH + "Usual-Medium.ttf")
.listEntry(FONT_PATH + "Usual-Regular.ttf")
.toList();
public static byte[] generatePDF(SubmissionDetails submission, String jspPage, String jspHeadPage, String margin) throws BusinessException
{
return generatePDF(submission, jspPage, jspHeadPage, margin, new HashMap());
......@@ -47,7 +56,8 @@ public class PDFUtils
data.put(DocumentTag.PAGE_STYLES, styleMap);
data.put(DocumentTag.JSP_BODY_INCLUDE, jspPage);
data.put(DocumentTag.JSP_HEAD_INCLUDE, jspHeadPage);
data.put(oneit.servlets.jsp.DocumentTag.EMBED_FONTS, documentFonts);
if(otherData != null && !otherData.isEmpty())
{
data.putAll(otherData);
......
......@@ -18,8 +18,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import oneit.appservices.config.ConfigMgr;
import oneit.logging.LogLevel;
......@@ -35,7 +33,6 @@ import oneit.utils.parsers.FieldException;
import performa.orm.Company;
import performa.orm.HiringTeam;
import performa.orm.PaymentPlan;
import performa.orm.types.AssessmentType;
import spark.utils.IOUtils;
......@@ -45,7 +42,6 @@ public class StripeUtils
public static final String STRIPE_PUB_KEY = ConfigMgr.getKeyfileString("stripe.pubkey","");
public static final String STRIPE_PLAN_ID = ConfigMgr.getKeyfileString("stripe.plan.id","0001");
public static final String STRIPE_COUPON_ID = ConfigMgr.getKeyfileString("stripe.coupon.id","EAP");
public static final String FONT_BASE_PATH = ConfigMgr.getConfigString("CONFIG.GLOBAL", "FontBaseLocation");
static
{
......
......@@ -4,7 +4,7 @@
<NODE name="CONFIG.GLOBAL::PERFORMA_ADMIN_PORTAL">
<PARAM name="PDFBaseLocation" factory="String" value="@cmsWebApp.deploy.dir@"/>
<PARAM name="FontBaseLocation" factory="String" value="@cmsWebApp.deploy.dir@/WEB-INF/fonts/"/>
<PARAM name="DocumentFontPath" factory="String" value="@config.deploy.dir@/binaries/fonts/"/>
</NODE>
<NODE name="StandardCMSTemplates::PERFORMA_ADMIN_PORTAL">
......
......@@ -52,27 +52,21 @@
};
$(document).ready(function(){
var fontPath = '<%= StripeUtils.FONT_BASE_PATH %>';
console.log(fontPath);
$(".oneit-radio input").each(function(){
if($(this).is(':checked')) {
updateRadioChecked(this);
}
$(this).click(function(){
if($(this).is(':checked')) {
updateRadioChecked(this);
$(".oneit-radio input").each(function(){
if($(this).is(':checked')) {
updateRadioChecked(this);
}
$(this).click(function(){
if($(this).is(':checked')) {
updateRadioChecked(this);
}
});
});
});
});
function updateRadioChecked(ele){
function updateRadioChecked(ele){
$("input[name='"+ $(ele).attr('name') +"'").closest('label').removeClass('checked');
$("input[name='"+ $(ele).attr('name') +"'").closest('.oneit-radio').removeClass('checked');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment