File: /home/kochikidswysewor/www/wp-content/themes/children-charity-child/mails/download-invoice.php--bkp
<?php
require_once 'vendor/autoload.php';
use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$args = array(
'post_type' => 'donations',
'p' => $id,
'posts_per_page' => 1
);
$query = new WP_Query( $args );
if( $query->have_posts() ) {
while( $query->have_posts() ) {
$query->the_post();
$amount= get_field('amount',$id);
$case = get_field('case',$id);
$transaction_id = get_field('transaction_id',$id);
$date = get_field('transaction_date',$id);
$name = get_field('name',$id);
$sample = '<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" style="box-sizing: border-box; -webkit-font-smoothing: antialiased; -webkit-appearance: none;">
<head>
<meta charset="utf-8"> <!-- utf-8 works for most cases -->
<meta name="viewport" content="width=device-width"> <!-- Forcing initial-scale shouldnt be necessary -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Use the latest (edge) version of IE rendering engine -->
<meta name="x-apple-disable-message-reformatting"> <!-- Disable auto-scale in iOS 10 Mail entirely -->
<meta name="format-detection" content="telephone=no,address=no,email=no,date=no,url=no"> <!-- Tell iOS not to automatically link certain text strings. -->
<meta name="color-scheme" content="light">
<meta name="supported-color-schemes" content="light">
<title>Kochi Kids</title>
<style type="text/css" media="screen">
/* What it does: Tells the email client that only light styles are provided but the client can transform them to dark. A duplicate of meta color-scheme meta tag above. */
:root {
color-scheme: light;
supported-color-schemes: light;
}
html,
body {
margin: 0 auto !important;
padding: 0 !important;
height: 100% !important;
background: #fafafa!important;
width: 100% !important;
font-family: sans-serif!important;
font-family: "Open Sans", Arial, sans-serif !important;
}
/* What it does: Stops email clients resizing small text. */
* {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
/* What it does: Centers email on Android 4.4 */
div[style*="margin: 16px 0"] {
margin: 0 !important;
}
[style*="Open Sans"] {
font-family: "Open Sans", Arial, sans-serif !important
}
/* What it does: forces Samsung Android mail clients to use the entire viewport */
#MessageViewBody, #MessageWebViewDiv{
width: 100% !important;
}
/* What it does: Stops Outlook from adding extra spacing to tables. */
table,
td {
mso-table-lspace: 0pt !important;
mso-table-rspace: 0pt !important;
}
/* What it does: Replaces default bold style. */
th {
font-weight: normal;
}
/* What it does: Fixes webkit padding issue. */
table {
border-spacing: 0 !important;
border-collapse: collapse !important;
table-layout: fixed !important;
margin: 0 auto !important;
}
/* What it does: Prevents Windows 10 Mail from underlining links despite inline CSS. Styles for underlined links should be inline. */
a {
text-decoration: none;
}
/* What it does: Uses a better rendering method when resizing images in IE. */
img {
-ms-interpolation-mode:bicubic;
}
/* What it does: A work-around for email clients meddling in triggered links. */
a[x-apple-data-detectors], /* iOS */
.unstyle-auto-detected-links a,
.aBn {
border-bottom: 0 !important;
cursor: default !important;
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
/* What it does: Prevents Gmail from changing the text color in conversation threads. */
.im {
color: inherit !important;
}
/* What it does: Prevents Gmail from displaying a download button on large, non-linked images. */
.a6S {
display: none !important;
opacity: 0.01 !important;
}
/* If the above doesnt work, add a .g-img class to any image in question. */
img.g-img + div {
display: none !important;
}
/* What it does: Removes right gutter in Gmail iOS app: https://github.com/TedGoas/Cerberus/issues/89 */
/* Create one of these media queries for each additional viewport size youd like to fix */
/* iPhone 4, 4S, 5, 5S, 5C, and 5SE */
@media only screen and (min-device-width: 320px) and (max-device-width: 374px) {
u ~ div .email-container {
min-width: 320px !important;
}
}
/* iPhone 6, 6S, 7, 8, and X */
@media only screen and (min-device-width: 375px) and (max-device-width: 413px) {
u ~ div .email-container {
min-width: 375px !important;
}
}
/* iPhone 6+, 7+, and 8+ */
@media only screen and (min-device-width: 414px) {
u ~ div .email-container {
min-width: 414px !important;
}
}
</style>
<!-- CSS Reset : END -->
<!-- Progressive Enhancements : BEGIN -->
<style>
/* What it does: Hover styles for buttons */
.button-td,
.button-a {
transition: all 100ms ease-in;
}
.button-td-primary:hover,
.button-a-primary:hover {
/* background: #555555 !important;
border-color: #555555 !important; */
}
/* Media Queries */
@media screen and (max-width: 740px) {
/*.email-container {
width: 100% !important;
margin: auto !important;
}*/
/* What it does: Forces table cells into full-width rows. */
.stack-column, th,
.stack-column-center {
display: block !important;
width: 100% !important;
margin:0px auto !important;
max-width: 100% !important;
direction: ltr !important;
}
/* And center justify these ones. */
.stack-column-center {
text-align: center !important;
}
/* What it does: Generic utility class for centering. Useful for images, buttons, and nested tables. */
.center-on-narrow {
text-align: center !important;
display: block !important;
margin-left: auto !important;
margin-right: auto !important;
float: none !important;
}
table.center-on-narrow {
display: inline-block !important;
}
/* What it does: Adjust typography on small screens to improve readability */
.email-container p {
font-size: 13px !important;
}
}
</style>
<!-- Progressive Enhancements : END -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css" />
</head>
<body width="100%" style="margin: 0; padding: 0!important; mso-line-height-rule: exactly; font-size: 14px; background-color: #fafafa; box-sizing: border-box; -webkit-font-smoothing: antialiased; -webkit-appearance: none;">
<center role="article" aria-roledescription="email" lang="en" style="width: 100%; margin: 0px auto; padding: 30px 0px; background-color: #fafafa;">
<table class="email-container" align="center" bgcolor="#fff" cellpadding="0" cellspacing="0" width="740" style="border-radius: 0px; -moz-border-radius: 0px; -webkit-border-radius: 0px; overflow: hidden;">
<tbody>
<tr style="position: relative;">
<td>
<table cellpadding="0" cellspacing="0" style="padding: 0px; margin: 0px; margin-top: 30px!important; margin-bottom: -30px!important; background-color: transparent;" width="680" valign="top" align="center" >
<tbody>
<tr>
<td align="center" style="padding: 0px; background-color: #f5f5f7;" bgcolor="#f5f5f7">
<p style="padding:30px 30px 60px; text-align: center; margin: 0px auto; line-height: 1.2; text-decoration: none; color: #666; font-size:14px; font-weight: 500;">Hello Kochikids,</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="position: relative; z-index: 2;">
<td>
<table cellpadding="0" cellspacing="0" width="100%" style="padding: 0px; margin: 0px; background-color: transparent;" >
<tbody>
<tr>
<td align="center" style="padding: 0px; height: 120px; background:transparent;">
<a href="#" target="_blank" style="display: inline-block; border-radius:30px; -moz-border-radius: 30px; -webkit-border-radius: 30px; width: 120px; height: 120px; overflow:hidden; background:#d4377a;"><img src="http://kochikids.wysework.net/wp-content/uploads/2019/12/Kochi-Kids.jpg" alt="Kochi Kids" style="float: none; margin: 0px auto; width: 120px; object-fit: contain; padding: 0px 0px;" title="Kochi Kids"></a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="position: relative; top: -50px; z-index: 1;">
<td>
<table cellpadding="0" cellspacing="0" width="100%" style="padding: 0px; margin: 0px; position: relative; background-color: #81256f;" bgcolor="#81256f">
<tbody>
<tr>
<td align="center" style="padding: 0px; height: 170px; background-color: #81256f;">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="position: relative; z-index: 2;">
<td>
<table width="680" valign="top" align="center" style="padding: 0px; margin-top: -130px!important; border-collapse: initial!important; margin-bottom: 30px!important; background: #fff; overflow: hidden; border-radius: 15px; -moz-border-radius: 15px; -webkit-border-radius: 15px; border:1px solid #ccc!important;">
<tbody>
<tr>
<td style="padding: 0px; margin: 0px;">
<table cellpadding="0" cellspacing="0" width="100%" style="background-color: #ffffff; margin-bottom: 0px!important;">
<tbody>
<tr>
<td style="padding:6% 4%; box-sizing: border-box;">
<table cellpadding="0" cellspacing="0" width="100%" style="box-sizing: border-box;">
<tbody>
<tr>
<td width="100%" style="vertical-align: top;">
<h2 style="font-family: Arial, sans-serif, "Open Sans"; padding: 0px; margin: 0px; margin-bottom: 10px; text-decoration: none; color: #000; text-align: center; font-size:30px; line-height: 1.2; font-weight: 500;">Donation Received</h2>
</td>
</tr>
<tr>
<td style="padding-right: 0%; width: 100%;">
<p style="font-family: Arial, sans-serif, "Open Sans"; padding: 0px; line-height: 1.6; margin: 20px 0px 0px; text-decoration: none; color: #000; text-align: left; font-size:14px; font-weight: 500;">This email confirms that you have received a donation of '.$amount.'CAD from '.$name'.</p>
<p style="font-family: Arial, sans-serif, "Open Sans"; padding: 0px; line-height: 1.6; margin: 20px 0px 0px; text-decoration: none; color: #000; text-align: left; font-size:14px; font-weight: 500;">You can <a href="#" style="color: #81256f; font-weight:bold;">view the transaction details online.</a></p>
<h3 style="font-family: Arial, sans-serif, "Open Sans"; padding: 0px; line-height: 1.2; margin: 25px 0px 0px; text-decoration: none; color: #666; text-align: left; font-size:20px; font-weight: 400;">Donation Details</h3>
</td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" width="100%" style="box-sizing: border-box; margin-top: 20px!important;">
<tbody>
<tr>
<td width="50%" style="vertical-align: top;">
<p style="line-height: 1.2; text-decoration: none; color: #000; text-align: left; font-size:14px; font-weight: 500;"><strong>Total amount:</strong></p>
</td>
<td width="50%" style="vertical-align: top;">
<p style="line-height: 1.2; text-decoration: none; color: #000; text-align: left; font-size:14px; font-weight: 500;">$ CAD</p>
</td>
</tr>
<tr>
<td width="50%" style="vertical-align: top;">
<p style="line-height: 1.2; text-decoration: none; color: #000; text-align: left; font-size:14px; font-weight: 500;"><strong>Currency:</strong></p>
</td>
<td width="50%" style="vertical-align: top;">
<p style="line-height: 1.2; text-decoration: none; color: #000; text-align: left; font-size:14px; font-weight: 500;">Canadian Dollars</p>
</td>
</tr>
<tr>
<td width="50%" style="vertical-align: top;">
<p style="line-height: 1.2; text-decoration: none; color: #000; text-align: left; font-size:14px; font-weight: 500;"><strong>Confirmation number: </strong></p>
</td>
<td width="50%" style="vertical-align: top;">
<p style="line-height: 1.2; text-decoration: none; color: #000; text-align: left; font-size:14px; font-weight: 500;"></p>
</td>
</tr>
<tr>
<td width="50%" style="vertical-align: top;">
<p style="line-height: 1.2; text-decoration: none; color: #000; text-align: left; font-size:14px; font-weight: 500;"><strong>Purpose: </strong></p>
</td>
<td width="50%" style="vertical-align: top;">
<p style="line-height: 1.2; text-decoration: none; color: #000; text-align: left; font-size:14px; font-weight: 500;">Contribute for'.$case->post_title.'</p>
</td>
</tr>
<tr>
<td width="50%" style="vertical-align: top;">
<p style="line-height: 1.2; text-decoration: none; color: #000; text-align: left; font-size:14px; font-weight: 500;"><strong>Contributor: </strong></p>
</td>
<td width="50%" style="vertical-align: top;">
<p style="line-height: 1.2; text-decoration: none; color: #000; text-align: left; font-size:14px; font-weight: 500;">'.$name.'</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" bgcolor="#81256f" width="100%" align="center">
<tbody>
<tr>
<td style="padding: 20px 0px;" align="center">
<a href="#" target="_blank" style="font-family: Arial, sans-serif, "Open Sans"; padding: 0px; margin: 0px; text-decoration: none; color: #fff; font-weight: bold; text-align: center;">Kochi Kids</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</center>
</body>
</html>';
echo $sample;
$dompdf->loadHtml($sample);
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
// $dompdf->stream('PaypalReceipt.pdf');
file_put_contents('pdf/Brochure.pdf', $dompdf->output());
}//end the while loop
}// end of the loop.