- Joined
- Oct 24, 2013
- Messages
- 47
- Reaction score
- 0
I have a page that displays an image followed by a table. The image shifts to the right when exporting the page to pdf. Moreover, I want to make the column headers and text font smaller.
I have included the function that triggers the export. BTW I am using SAAS system.
I have included the function that triggers the export. BTW I am using SAAS system.
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Applicants By Country</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
@STYLELINK@
<style>
/* Change this value to 700px for Portrait Printing or 950px for landscape */
.reportwrapper table {width:95%;}
.reportwrapper TH.Sub a {
font-size: 12px;
color: #333333;
text-decoration: none;
}
.reportwrapper .Data1, .reportwrapper .Data2 {
font-size: 11px;
padding: 6px 5px;
border-bottom: 1px solid #f5f4f3;
}
</style>
</head>
<body class="reportwrapper">
<div class="option_bar_in report" style="pd4ml-display:none">
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center" style="border-collapse:collapse;">
<tr>
<td>
<div style="pd4ml-display:none"><button type="submit" class="ButtonSm" onClick="pdfwrite();"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>Create PDF</button>
@fileexportbutton@
@navbar@
</div>
</td>
</tr>
</table>
</div>
<!--Switch Page Orientation for your printing requirements-->
<!--Use Landscape-->
<!--Use TTF-->
<!--filename='The Book - Applicants By Country'-->
<!--START: Header and Footer when converted to PDF-->
<pd4ml:page.header>
<div class="reportheader">
<div id="header_container_in">
<div id="header_container_in">
<div class="header_container_left" style="margin-left: 50px;">
<a href="javascript:void();">
<img class="header_logo" style="margin-bottom: 20px !important;" id="header_logo_lg" src="/resources/1439748_462012121a8e9d32/lg_ClaraAbbott_Logo_black_RGB_F_final.jpg" alt="Clara Abbott Foundation Logo" valign="top" border="0" align="left">
</a>
</div>
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<h1>Applicants By Country</h1>
<h3>@currentdate@</h3>
</div>
</div>
</td>
</tr>
</table>
</div>
</pd4ml:page.header>
<pd4ml:page.footer>
<div style="pd4ml-display:block;display:none; margin-bottom:20px; margin-top:10px;">
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td style="text-align:left" class="reportfooter"></td>
<td style="text-align:right" class="reportfooter">page $[page] of $[total]</td>
</tr>
</table>
</div>
</pd4ml:page.footer>
<!--END Header and Footer for PDF-->
<pd4ml>
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center" style="border-collapse:collapse;">
@header@
@rows@
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center" style="border-collapse:collapse; margin-top:30px; pd4ml-display: none;">
<tr>
<td class="reportfooter"></td>
</tr>
</table>
</pd4ml>
</body>
</html>
JavaScript:
//Code that triggers when I click on the export button
function pdfwrite(){
var frm = document.forms[0];
var data = $(frm).serializeArray();
$(data).each(function (i, item) {
if (item.name === 'curpagesize') {
item.value = "0";
}
});
var request = $.ajax({
url: $(frm).attr('action'),
type: 'GET',
data: $.param(data),
});
request.done(function (txt) {
var new_win = window.open('','new_win', 'menubar=no,scrollbars=yes,width=800,height=800,status=no,resizable=yes,dependent=yes,alwaysRaised=yes');
new_win.opener = window;
new_win.focus();
var form = document.createElement("form");
var textelement = document.createElement("textarea");
textelement.type = "text";
textelement.name = "txt";
textelement.value = txt;
form.appendChild(textelement);
form.style.display = "none";
form.action = "/pdfWriter";
form.method = "POST";
form.target = "new_win";
form.name = "pdfwriteform";
document.body.appendChild(form);
submitToDocGen(form, "/pdfWriter", "new_win", function() {document.body.removeChild(document.forms["pdfwriteform"]);});
});
}