Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Plantilla de ejemplo para Gravity PDF
<?php
/**
* Template Name: DocumentoEjemplo
* Version: 0.1
* Description:
* Author:
* Author URI:
* Group: Grupo ejemplo
* License: GPLv2
* Required PDF Version: 4.0
* Tags:
*/
/* Prevent direct access to the template (always good to include this) */
if ( ! class_exists( 'GFForms' ) ) {
return;
}
?>
<!-- Any PDF CSS styles can be placed in the style tag below -->
<!-- Include styles needed for the PDF -->
<style>
/* Handle Gravity Forms CSS Ready Classes */
.row-separator {
clear: both;
padding: 1.25mm 0;
}
.gf_left_half,
.gf_left_third, .gf_middle_third,
.gf_first_quarter, .gf_second_quarter, .gf_third_quarter,
.gf_list_2col li, .gf_list_3col li, .gf_list_4col li, .gf_list_5col li {
float: left;
}
.gf_right_half,
.gf_right_third,
.gf_fourth_quarter {
float: right;
}
.gf_left_half, .gf_right_half,
.gf_list_2col li {
width: 49%;
}
.gf_left_third, .gf_middle_third, .gf_right_third,
.gf_list_3col li {
width: 32.3%;
}
.gf_first_quarter, .gf_second_quarter, .gf_third_quarter, .gf_fourth_quarter {
width: 24%;
}
.gf_list_4col li {
width: 24%;
}
.gf_list_5col li {
width: 19%;
}
.gf_left_half, .gf_right_half {
padding-right: 1%;
}
.gf_left_third, .gf_middle_third, .gf_right_third {
/*padding-right: 1.505%;*/
}
.gf_first_quarter, .gf_second_quarter, .gf_third_quarter, .gf_fourth_quarter {
/*padding-right: 1.333%;*/
}
.gf_right_half, .gf_right_third, .gf_fourth_quarter {
/*padding-right: 0;*/
}
/* Don't double float the list items if already floated (mPDF does not support this ) */
.gf_left_half li, .gf_right_half li,
.gf_left_third li, .gf_middle_third li, .gf_right_third li {
width: 100% !important;
float: none !important;
}
/*
* Headings
*/
h3 {
margin: 1.5mm 0 0.5mm;
padding: 0;
}
/*
* Quiz Style Support
*/
.gquiz-field {
color: #666;
}
.gquiz-correct-choice {
font-weight: bold;
color: black;
}
.gf-quiz-img {
padding-left: 5px !important;
vertical-align: middle;
}
/*
* Survey Style Support
*/
.gsurvey-likert-choice-label {
padding: 4px;
}
.gsurvey-likert-choice, .gsurvey-likert-choice-label {
text-align: center;
}
/*
* Terms of Service (Gravity Perks) Support
*/
.terms-of-service-agreement {
padding-top: 2px;
font-weight: bold;
}
.terms-of-service-tick {
font-size: 150%;
}
/*
* List Support
*/
ul, ol {
margin: 0;
padding-left: 1mm;
padding-right: 1mm;
}
li {
margin: 0;
padding: 0;
list-style-position: inside;
}
/*
* Header / Footer
*/
.alignleft {
float: left;
}
.alignright {
float: right;
}
.aligncenter {
text-align: center;
}
p.alignleft {
text-align: left;
float: none;
}
p.alignright {
text-align: right;
float: none;
}
/*
* Independant Template Styles
*/
#form_title {
text-align: center;
text-transform: uppercase;
font-size: 22px;
}
.row-separator {
margin-bottom: 15px;
}
.gfpdf-page, .product-field-title {
margin-bottom: -13px;
margin-left: 10px;
}
.gfpdf-field .inner-container {
background: <?php echo $container_background_color; ?>;
border-radius: 10px;
}
.gfpdf-field .label {
padding: 5px 10px 0;
}
.gfpdf-field .value {
padding: 0 10px 5px;
}
.gfpdf-products .inner-container,
div.gfpdf-html .value {
padding: 5px 10px;
}
div.gfpdf-section-description .inner-container {
background: none;
border-radius: 0;
}
.gfpdf-section-title {
padding-left: 10px;
}
.gfpdf-section-title h3 {
margin-top: 0;
padding-top: 0;
}
.gfield_list th,
table.entry-products th, table.entry-products td.emptycell {
background-color: <?php echo $contrast['background']; ?>;
}
.gfield_list th, .gfield_list td,
table.entry-products th, table.entry-products td {
border: 1px solid <?php echo $contrast['border']; ?>;
}
</style>
<h1 class="aligncenter">Hello World</h1>
<div class="row-separator aligncenter">
<img src="URL_Logotipo" />
</div>
<?php
$nombre=$form_data['field'][2]['first'];
$apellido1=$form_data['field'][2]['last'];
$correo=$form_data['field'][3];
echo "Nombre: $nombre <br />";
echo "Apellidos: $apellido1 <br />";
echo "Correo: $correo <br />";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.