Dinamiko / dk-pdf

WordPress to PDF made easy
https://wordpress.org/plugins/dk-pdf
26 stars 23 forks source link

Change PDF different orientation for one post. #85

Open Feelosov opened 4 years ago

Feelosov commented 4 years ago

Hi. This is best plugin of all. Can you do that: i change PDF orientation on fly for page posts? For example, i insert your short-code [dkpdf-pagebreak-horizontal] then [dkpdf-pagebreak-horizontal] then [dkpdf-pagebreak-vertical]

Feelosov commented 4 years ago

As i see, its possible: https://mpdf.github.io/paging/page-breaks.html

Cit:

You can define or change all page characteristics when you add the new page: orientation

Feelosov commented 4 years ago

Issue solved: Add CSS into your file, for example:

@page horizontal { size: landscape; } div.horizontal-pdf-orientation { page: horizontal; page-break-before: left; }

and in your post add <div class="horizontal-pdf-orientation"></div> - after this DIV all pages in PDF will have horizontal orientation.

Some more - register a tiny shortcode:

function dkpdf_pagebreak_shortcode_horizontal( $atts, $content = null ) {
    $output = '<div class="horizontal-pdf-orientation"></div>';
    return $output;
}
add_shortcode( 'dkpdf-pagebreak-horizont', 'dkpdf_pagebreak_shortcode_horizontal' );

and use : [dkpdf-pagebreak-horizont]

So if you want vertical orientation after horizontal orientation , add new styles in your CSS for vertical.