Commit 26b9b179 by Nilu

Adding fonts for PDF generation

parent 892b7918
...@@ -2,6 +2,7 @@ package performa.utils; ...@@ -2,6 +2,7 @@ package performa.utils;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import oneit.appservices.config.ConfigMgr; import oneit.appservices.config.ConfigMgr;
...@@ -12,13 +13,21 @@ import oneit.logging.LoggingArea; ...@@ -12,13 +13,21 @@ import oneit.logging.LoggingArea;
import oneit.servlets.forms.SubmissionDetails; import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.jsp.DocumentTag; import oneit.servlets.jsp.DocumentTag;
import oneit.utils.BusinessException; import oneit.utils.BusinessException;
import oneit.utils.CollectionUtils;
import oneit.utils.NestedException; import oneit.utils.NestedException;
public class PDFUtils public class PDFUtils
{ {
public static final String FILE_BASE_PATH = ConfigMgr.getConfigString("CONFIG.GLOBAL", "PDFBaseLocation"); 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 public static byte[] generatePDF(SubmissionDetails submission, String jspPage, String jspHeadPage, String margin) throws BusinessException
{ {
return generatePDF(submission, jspPage, jspHeadPage, margin, new HashMap()); return generatePDF(submission, jspPage, jspHeadPage, margin, new HashMap());
...@@ -47,7 +56,8 @@ public class PDFUtils ...@@ -47,7 +56,8 @@ public class PDFUtils
data.put(DocumentTag.PAGE_STYLES, styleMap); data.put(DocumentTag.PAGE_STYLES, styleMap);
data.put(DocumentTag.JSP_BODY_INCLUDE, jspPage); data.put(DocumentTag.JSP_BODY_INCLUDE, jspPage);
data.put(DocumentTag.JSP_HEAD_INCLUDE, jspHeadPage); data.put(DocumentTag.JSP_HEAD_INCLUDE, jspHeadPage);
data.put(oneit.servlets.jsp.DocumentTag.EMBED_FONTS, documentFonts);
if(otherData != null && !otherData.isEmpty()) if(otherData != null && !otherData.isEmpty())
{ {
data.putAll(otherData); data.putAll(otherData);
......
...@@ -18,8 +18,6 @@ import java.util.Date; ...@@ -18,8 +18,6 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import oneit.appservices.config.ConfigMgr; import oneit.appservices.config.ConfigMgr;
import oneit.logging.LogLevel; import oneit.logging.LogLevel;
...@@ -35,7 +33,6 @@ import oneit.utils.parsers.FieldException; ...@@ -35,7 +33,6 @@ import oneit.utils.parsers.FieldException;
import performa.orm.Company; import performa.orm.Company;
import performa.orm.HiringTeam; import performa.orm.HiringTeam;
import performa.orm.PaymentPlan; import performa.orm.PaymentPlan;
import performa.orm.types.AssessmentType;
import spark.utils.IOUtils; import spark.utils.IOUtils;
...@@ -45,7 +42,6 @@ public class StripeUtils ...@@ -45,7 +42,6 @@ public class StripeUtils
public static final String STRIPE_PUB_KEY = ConfigMgr.getKeyfileString("stripe.pubkey",""); 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_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 STRIPE_COUPON_ID = ConfigMgr.getKeyfileString("stripe.coupon.id","EAP");
public static final String FONT_BASE_PATH = ConfigMgr.getConfigString("CONFIG.GLOBAL", "FontBaseLocation");
static static
{ {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<NODE name="CONFIG.GLOBAL::PERFORMA_ADMIN_PORTAL"> <NODE name="CONFIG.GLOBAL::PERFORMA_ADMIN_PORTAL">
<PARAM name="PDFBaseLocation" factory="String" value="@cmsWebApp.deploy.dir@"/> <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>
<NODE name="StandardCMSTemplates::PERFORMA_ADMIN_PORTAL"> <NODE name="StandardCMSTemplates::PERFORMA_ADMIN_PORTAL">
......
...@@ -52,27 +52,21 @@ ...@@ -52,27 +52,21 @@
}; };
$(document).ready(function(){ $(document).ready(function(){
$(".oneit-radio input").each(function(){
var fontPath = '<%= StripeUtils.FONT_BASE_PATH %>'; if($(this).is(':checked')) {
updateRadioChecked(this);
console.log(fontPath); }
$(this).click(function(){
$(".oneit-radio input").each(function(){ if($(this).is(':checked')) {
updateRadioChecked(this);
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('label').removeClass('checked');
$("input[name='"+ $(ele).attr('name') +"'").closest('.oneit-radio').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