wordpress - 弄清楚如何在自定义 pdf 主题(DOMpdf 和 Fooevents)时修复空白页
问题描述
我们正在使用 Fooevents 为客户生成门票和年卡。但我无法让它工作。我们正在尝试编辑 pdf 使年卡看起来像这样,第二页和第三页看起来不错,但我们需要它没有第一个空白页
这是下面的 Header.php
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--[if !mso]><!-->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--<![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<?php
if ($ticket['WooCommerceEventsTicketBackgroundColor'] == "#55AF71" || empty($ticket['WooCommerceEventsTicketBackgroundColor']) || $ticket['name'] == __('Preview Event', 'woocommerce-events')) {
$ticket['WooCommerceEventsTicketBackgroundColor'] = "#fff";
}
?>
<style>
@page { margin: 0px; }
<?php echo $font_face; ?>
body {
background-color: #ffffff;
padding: 0px;
margin: 0px !important;
font-family: <?php echo $font_family; ?>;
}
.two-column:first-of-type {
page-break-before:avoid;
}
.two-column{
max-width: 100% !important;
margin: 0px !important;
padding: 0px !important;
page-break-before:always;
}
a[href^=tel], a[href^="x-apple-data-detectors:"] { color: inherit; text-decoration: none; }
@media screen and (max-width: 640px), screen and (max-device-width: 640px), screen and (min-resolution: 3dppx) and (max-device-width: 1920px) {
.four-column .column {
max-width: 100% !important;
margin: 0px !important;
}
}
</style>
</head>
<body style="padding: 5px;background-color: #ffffff;margin: 0 !important; width:311.25px; height:194px;">
这是下面的 Ticket.php
<?php
if ($ticket['WooCommerceEventsTicketButtonColor'] == "#55AF71" || empty($ticket['WooCommerceEventsTicketButtonColor']) || $ticket['name'] == __('Preview Event', 'woocommerce-events')) {
$ticket['WooCommerceEventsTicketButtonColor'] = "#39C4CD";
}
if ($ticket['WooCommerceEventsTicketBackgroundColor'] == "#55AF71" || empty($ticket['WooCommerceEventsTicketBackgroundColor']) || $ticket['name'] == __('Preview Event', 'woocommerce-events')) {
$ticket['WooCommerceEventsTicketBackgroundColor'] = "#192030";
}
if (empty($ticket['WooCommerceEventsTicketTextColor']) || $ticket['name'] == __('Preview Event', 'woocommerce-events')) {
$ticket['WooCommerceEventsTicketTextColor'] = "#ffffff";
}
?>
<?php if (!empty($ticket['ticketNumber']) && $ticket['ticketNumber'] > 1) : ?>
<?php endif; ?>
<?php if (((empty($ticket['type']) || $ticket['type'] == "HTML") && !empty($ticket['ticketNumber']) && $ticket['ticketNumber'] == 1) || (!empty($ticket['type']) && $ticket['type'] == "PDF") || $ticket['name'] == __('Preview Event', 'woocommerce-events')) : ?>
<!--[if mso]>
<table width="600" align="center" style="max-width: 600px;margin:0 auto;"><tr><td>
<![endif]-->
<!--[if mso]>
</td></tr></table>
<![endif]-->
<?php endif; ?>
<!--[if mso]>
<table width="600" align="center" style="max-width: 600px;margin:0 auto;"><tr><td colspan="3">
<table align="center" width="600" cellpadding="10"><tr><td> </td></tr></table>
</td></tr><tr><td width="300">
<![endif]-->
<!--[if !mso]><!---->
<!--<div class="two-column" style="max-width: 600px; width: 100%;background-color:<?php echo $ticket['WooCommerceEventsTicketBackgroundColor']; ?>; margin: 0 auto;font-family: 'DejaVu Sans', 'Helvetica', 'sans-serif';">-->
<![endif]-->
<!--[if mso]>
</td><td width="300">
<![endif]-->
<!--[if !mso]><!---->
<!--[if mso]>
</td></tr><tr><td colspan="3"><table align="center" width="600" cellpadding="10"><tr><td> </td></tr></table></td></tr><tr></table>
<![endif]-->
<?php if($ticket['WooCommerceEventsTicketPurchaserDetails'] != 'off' || $ticket['WooCommerceEventsTicketDisplayBarcode'] != 'off') :?>
<!--[if mso]>
<table width="598" align="center" style="max-width: 598px;border: 1px solid #ffffff; border-radius: 8px !important; margin:0 auto;"><tr><td width="299">
<![endif]-->
<!--[if !mso]><!---->
<div class="two-column" style="color: #000000; float: left;">
<div style="width:70%;margin-left: 10px; border-bottom:1px solid black;">
<h1 style="font-size: 12px; color: #000000; margin:0px; padding:0px;"><?php _e('', 'woocommerce-events'); ?> <b style="font-weight: bold;"><?php echo $ticket['name'] ?></b></h1>
</div>
<![endif]-->
<div class="column" style="width: 150px; float:left; margin: 30px 0px 0px 10px;">
<![endif]-->
<?php if($ticket['WooCommerceEventsTicketPurchaserDetails'] != 'off') :?>
<!--[if mso]>
</td><td width="230">
<![endif]-->
<div class="ticket_icon" style="float: left;">
<img style="display:block; width:100px; height:100px;" src="<?php echo $ticket['WooCommerceEventYearCardImage']; ?>" class="code" style="border: solid 1px #eee;" /><br>
<?php if(!empty($ticket['fooevents_custom_attendee_fields_options_array']) && (isset($ticket['WooCommerceEventsIncludeCustomAttendeeDetails']) && $ticket['WooCommerceEventsIncludeCustomAttendeeDetails'] != 'off')) :?>
<?php foreach($ticket['fooevents_custom_attendee_fields_options_array'] as $custom_attendee_fields) :?>
<?php echo '<span class="ticket_detail_text" style="font-size:10px;">'; ?>
<?php echo $custom_attendee_fields['value']; ?>
<?php echo '</span>'; ?>
<?php endforeach; ?>
<?php endif; ?>
</div>
<div class="ticket_details" style="float: right; width: 100%; ">
<?php if (!empty($ticket['WooCommerceEventsAttendeeName']) || !empty($ticket['WooCommerceEventsAttendeeLastName'])): ?><span style="display: none; color: white;<?php echo $ticket['WooCommerceEventsTicketTextColor']; ?> !important;opacity:0.7;line-height: 16px;font-size: 14px;" class="ticket_detail_text"><font style="color:<?php echo $ticket['WooCommerceEventsTicketTextColor']; ?> !important; display:none; text-decoration:none;" color="white"><?php echo $ticket['WooCommerceEventsAttendeeName']; ?> <?php echo $ticket['WooCommerceEventsAttendeeLastName']; ?></font></span><?php endif; ?>
<?php if(!empty($ticket['WooCommerceEventsAttendeeTelephone'])) :?>
<span class="ticket_detail_bullet" style="display: none;"></span>
<span style="display: none;" class="ticket_detail_text"><font style="" color="white"><?php echo $ticket['WooCommerceEventsAttendeeTelephone']; ?></font></span>
<?php endif; ?>
<?php if(!empty($ticket['WooCommerceEventsAttendeeCompany'])) :?>
<span class="ticket_detail_bullet" style=""></span>
<span style="" class="ticket_detail_text"><font style="color:<?php echo $ticket['WooCommerceEventsTicketTextColor']; ?> !important;text-decoration:none;" color="white"><?php echo $ticket['WooCommerceEventsAttendeeCompany']; ?></font></span>
<?php endif; ?>
<?php if(!empty($ticket['WooCommerceEventsAttendeeDesignation'])) :?>
<span class="ticket_detail_bullet" style=""></span>
<span style="" class="ticket_detail_text"><font style="color:<?php echo $ticket['WooCommerceEventsTicketTextColor']; ?> !important;text-decoration:none;" color="white"><?php echo $ticket['WooCommerceEventsAttendeeDesignation']; ?></font></span>
<?php endif; ?>
<?php if($ticket['WooCommerceEventsTicketDisplayPrice'] != 'off') :?>
<span class="ticket_detail_bullet" style=""></span>
<span class="ticket_detail_text" style=""><font style="color:<?php echo $ticket['WooCommerceEventsTicketTextColor']; ?> !important; text-decoration:none;" color="white"><?php if(!empty($ticket['WooCommerceEventsPrice'])) echo $ticket['WooCommerceEventsPrice']; else if(!empty($ticket['price'])) echo $ticket['price']; ?></font></span>
<?php endif; ?>
<?php if(!empty($ticket['WooCommerceEventsVariations'])) :?>
<?php foreach($ticket['WooCommerceEventsVariations'] as $variationName => $variationValue) :?>
<?php echo '<span class="ticket_detail_bullet" style=""></span><span class="ticket_detail_text" style=""><font style="color:' . $ticket['WooCommerceEventsTicketTextColor'] . ' !important; text-decoration:none;" color="white"><strong>' . $variationName . ':</strong> ' . $variationValue . '</span>'; ?>
<?php endforeach; ?>
<?php endif; ?>
<!-- SEATING -->
<?php if(!empty($ticket['fooevents_seating_options_array'])) :?>
<?php echo '<span class="ticket_detail_bullet" style="">•</span>'; ?>
<?php echo '<span class="ticket_detail_text" style=""><font style="color:' . $ticket['WooCommerceEventsTicketTextColor'] . ' !important; text-decoration:none;" color="white">'; ?>
<?php echo '<strong>'.$ticket['fooevents_seating_options_array']['row_name_label'].':</strong> '.$ticket['fooevents_seating_options_array']['row_name']; ?>
<?php echo '<span class="ticket_detail_bullet" style="">•</span>'; ?>
<?php echo '<strong>'.$ticket['fooevents_seating_options_array']['seat_number_label'].':</strong> '.$ticket['fooevents_seating_options_array']['seat_number']; ?>
<?php echo '</font></span>'; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<!--[if !mso]><!---->
</div>
<div class="column" style="width: 150px; float:right; text-align:center; margin: 30px 0px 0px 0px;">
<?php if($ticket['WooCommerceEventsTicketDisplayBarcode'] != 'off') :?>
<!--[if mso]>
<table align="center" width="300" cellpadding="10"><tr><td> </td></tr></table>
<![endif]-->
<img width="85px;" style="" src="<?php echo $barcodeURL; ?>" title="Barcode"><br />
<?php endif; ?>
<span style="font-size:10px; color:#000000;"><?php echo 'Udløbsdato: ' . $ticket['WooCommerceEventsTicketExpireFormatted']; ?></span>
</div>
<!--[if mso]>
</td><td width="69">
<![endif]-->
<!--[if !mso]><!---->
</div>
<![endif]-->
<!--[if mso]>
</td></tr></table>
<![endif]-->
<?php endif; ?>
<?php if(!empty($ticket['type']) && $ticket['type'] == "PDF") : ?>
<!--[if mso]>
<table width="600" align="center" style="max-width: 600px;margin:0 auto;"><tr><td>
<table align="center" width="300" cellpadding="10"><tr><td> </td></tr></table>
<![endif]-->
<?php if(!empty($ticket['FooEventsTicketFooterText'])) :?>
<!--[if !mso]><!---->
<div class="footer" style="max-width: 600px; margin: 0 auto; width: 100%;">
<![endif]-->
<p style="padding:0 15px;text-align:center;font-size:12px; color:<?php echo $ticket['WooCommerceEventsTicketTextColor']; ?>;font-family: <?php echo $font_family; ?>;"><?php echo $ticket['FooEventsTicketFooterText'];?></p>
</div>
<![endif]-->
<br /><br />
<?php endif; ?>
<?php if($ticket['name'] == __('Preview Event', 'woocommerce-events')): ?>
<!--[if !mso]><!---->
<div class="footer" style="max-width: 600px; margin: 0 auto; width: 100%;">
<![endif]-->
<p style="padding:0 15px;text-align:center;font-size:12px; color:<?php echo $ticket['WooCommerceEventsTicketTextColor']; ?>;font-family: <?php echo $font_family; ?>;"><?php _e('Contact us for questions and concerns.', 'woocommerce-events'); ?></p>
<!--[if !mso]><!---->
</div>
<![endif]-->
<br /><br /><br /><br />
<?php endif; ?>
<!--[if mso]>
</td></tr></table>
<![endif]-->
<?php endif; ?>
这是下面的Footer.php
<?php
if (empty($ticket['WooCommerceEventsTicketTextColor']) || $ticket['name'] == __('Preview Event', 'woocommerce-events')) {
$ticket['WooCommerceEventsTicketTextColor'] = "#ffffff";
}
?>
<?php if((empty($ticket['type']) || $ticket['type'] == "HTML")) :?>
<!--[if mso]>
<table width="600" align="center" style="max-width: 600px;margin:0 auto;"><tr><td>
<table align="center" width="300" cellpadding="10"><tr><td> </td></tr></table>
<![endif]-->
<?php if(!empty($ticket['FooEventsTicketFooterText'])) :?>
<!--[if !mso]><!---->
<div class="footer" style="max-width: 600px; margin: 0 auto; width: 100%;">
<![endif]-->
<p style="padding:0 15px;text-align:center;font-size:12px; color:<?php echo $ticket['WooCommerceEventsTicketTextColor']; ?>;font-family: <?php echo $font_family; ?>;"><?php echo $ticket['FooEventsTicketFooterText'];?></p>
</div>
<![endif]-->
<br /><br />
<?php endif; ?>
<?php if($ticket['name'] == __('Preview Event', 'woocommerce-events')): ?>
<!--[if !mso]><!---->
<div class="footer" style="max-width: 600px; margin: 0 auto; width: 100%;">
<![endif]-->
<p style="padding:0 15px;text-align:center;font-size:12px; color:<?php echo $ticket['WooCommerceEventsTicketTextColor']; ?>;font-family: <?php echo $font_family; ?>;"><?php _e('Contact us for questions and concerns.', 'woocommerce-events'); ?></p>
<!--[if !mso]><!---->
</div>
<![endif]-->
<br /><br /><br /><br />
<?php endif; ?>
<!--[if mso]>
</td></tr></table>
<![endif]-->
<?php endif; ?>
</body>
我真的希望这里的一些编码专家可以帮助我,不要犹豫提出更多问题,以防你认为你可以帮助我弄清楚如何解决这个问题。
解决方案
推荐阅读
- javascript - [JavaScript]EventLoop中的任务和宏任务是什么关系?
- reactjs - 我可以使用大量插件更改 video.js 中跳过按钮的样式吗?
- amazon-web-services - 在 JAVA sdk 的 quickSight 中的 CreateDataSource 方法中面临问题 DataSourceId 参数
- oauth-2.0 - Fiware Generic Enabler 的 OpenID 连接机制
- java - 使用线程 id 或名称获取 threadGroup
- azure-active-directory - “指定的登录会话不存在。它可能已被终止”在我将设备加入到 azure 活动目录后
- flutter - 如何将 PickedFile 类型的集合图像保存到 Flutter 中的图像?
- node.js - MongoDB ObjectID 查询更新
- javascript - 重复活动 Google 日历请求失败
- bash - 如何在命令行中使用 mutt 发送带有 Content-ID 标头的 html 邮件