Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to choose page size and orientation in pdf templates #2275

Merged
merged 6 commits into from Apr 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/language/en_us.lang.php
Expand Up @@ -3970,3 +3970,8 @@
$app_list_strings['day_list']['Friday'] = 'Friday';
$app_list_strings['day_list']['Saturday'] = 'Saturday';
$app_list_strings['day_list']['Sunday'] = 'Sunday';
$app_list_strings['pdf_page_size_dom']['A4'] = 'A4';
$app_list_strings['pdf_page_size_dom']['Letter'] = 'Letter';
$app_list_strings['pdf_page_size_dom']['Legal'] = 'Legal';
$app_list_strings['pdf_orientation_dom']['Portrait'] = 'Portrait';
$app_list_strings['pdf_orientation_dom']['Landscape'] = 'Landscape';
3 changes: 2 additions & 1 deletion modules/AOS_PDF_Templates/generatePdf.php
Expand Up @@ -140,7 +140,8 @@ function ($matches) {

ob_clean();
try {
$pdf = new mPDF('en', 'A4', '', 'DejaVuSansCondensed', $template->margin_left, $template->margin_right, $template->margin_top, $template->margin_bottom, $template->margin_header, $template->margin_footer);
$orientation = ($template->orientation == "Landscape") ? "-L" : "";
$pdf = new mPDF('en', $template->page_size . $orientation, '', 'DejaVuSansCondensed', $template->margin_left, $template->margin_right, $template->margin_top, $template->margin_bottom, $template->margin_header, $template->margin_footer);
$pdf->SetAutoFont();
$pdf->SetHTMLHeader($header);
$pdf->SetHTMLFooter($footer);
Expand Down
2 changes: 2 additions & 0 deletions modules/AOS_PDF_Templates/language/en_us.lang.php
Expand Up @@ -83,5 +83,7 @@
'LBL_MARGIN_FOOTER' => 'Margin Footer',
'LBL_EDITVIEW_PANEL1' => 'Margins',
'LBL_DETAILVIEW_PANEL1' => 'Margins',
'LBL_PAGE_SIZE' => 'Page Size',
'LBL_ORIENTATION' => 'Orientation',
);
?>
17 changes: 15 additions & 2 deletions modules/AOS_PDF_Templates/metadata/detailviewdefs.php
Expand Up @@ -72,6 +72,19 @@
),
),
2 =>
array (
0 =>
array (
'name' => 'page_size',
'label' => 'LBL_PAGE_SIZE',
),
1 =>
array (
'name' => 'orientation',
'label' => 'LBL_ORIENTATION',
),
),
3 =>
array (
0 =>
array (
Expand All @@ -80,7 +93,7 @@
'customCode' => '{$fields.pdfheader.value}',
),
),
3 =>
4 =>
array (
0 =>
array (
Expand All @@ -89,7 +102,7 @@
'customCode' => '{$fields.description.value}',
),
),
4 =>
5 =>
array (
0 =>
array (
Expand Down
19 changes: 16 additions & 3 deletions modules/AOS_PDF_Templates/metadata/editviewdefs.php
Expand Up @@ -91,6 +91,19 @@
1 => '',
),
3 =>
array (
0 =>
array (
'name' => 'page_size',
'label' => 'LBL_PAGE_SIZE',
),
1 =>
array (
'name' => 'orientation',
'label' => 'LBL_ORIENTATION',
),
),
4 =>
array (
0 =>
array (
Expand All @@ -99,23 +112,23 @@
'customCode' => '{$INSERT_FIELDS}',
),
),
4 =>
5 =>
array (
0 =>
array (
'name' => 'description',
'label' => 'LBL_DESCRIPTION',
),
),
5 =>
6 =>
array (
0 =>
array (
'name' => 'pdfheader',
'label' => 'LBL_HEADER',
),
),
6 =>
7 =>
array (
0 =>
array (
Expand Down
38 changes: 38 additions & 0 deletions modules/AOS_PDF_Templates/vardefs.php
Expand Up @@ -268,6 +268,44 @@
'enable_range_search' => false,
'disable_num_format' => '',
),
'page_size' =>
array (
'required' => '0',
'name' => 'page_size',
'vname' => 'LBL_PAGE_SIZE',
'type' => 'enum',
'massupdate' => 0,
'default' => '',
'comments' => '',
'help' => '',
'importable' => 'true',
'duplicate_merge' => 'disabled',
'duplicate_merge_dom_value' => '0',
'audited' => 0,
'reportable' => 0,
'len' => 100,
'options' => 'pdf_page_size_dom',
'studio' => 'visible',
),
'orientation' =>
array (
'required' => '0',
'name' => 'orientation',
'vname' => 'LBL_ORIENTATION',
'type' => 'enum',
'massupdate' => 0,
'default' => '',
'comments' => '',
'help' => '',
'importable' => 'true',
'duplicate_merge' => 'disabled',
'duplicate_merge_dom_value' => '0',
'audited' => 0,
'reportable' => 0,
'len' => 100,
'options' => 'pdf_orientation_dom',
'studio' => 'visible',
),
),
'relationships'=>array (
),
Expand Down