question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Switching between multiple Page templates not working

See original GitHub issue

I think this example from the documentation is not working:

<html>
<head>
<style>
    @page title_template { margin: 5cm; }
    @page regular_template { margin: 2cm; }
</style>
</head>

<body>
    <h1>Title Page</h1>
    This is a title page with a large 5cm margin.

    <!-- switch page templates -->
    <pdf:nexttemplate name="regular_template" />

    <h1>Chapter 1</h1>
    This is a regular page with a regular 2cm margin.
</body>
</html>

I am simply trying to reproduce this example, but the margins are always the same and there is only one page.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
lcsdovallecommented, Aug 22, 2020

Try this one. IT works!!!


<style type="text/css">
    @page {        
        size: A4 landscape;
        margin: 0cm;
        background-image: url({{bg_front}});  
        @frame texto {            
            left: 150px;
            width: 900px;
            top: 280px;
            height: 900pt;                        
        }
    }    
    @page front_template{        
        size: A4 landscape;
        margin: 0cm;
        background-image: url({{bg_front}});  
        @frame texto {            
            left: 150px;
            width: 900px;
            top: 280px;
            height: 900pt;                        
        }
    }    

    @page back_template {
        size: A4 landscape;                
        background-image: url({{bg_back}});  
        @frame fundo {            
            left: 520px;
            width: 90px;
            top: 730px;
            height: 900pt;                        
        }
    }
</style>

<body>
    <!-- Content for Static Frame 'header_frame' -->    
    <!-- <pdf:nexttemplate name="front_template" />     -->
    <div id="texto" style="text-align:justify" >
        <p style="font-size: 18pt;">{{texto}}</p>
        <!-- <p style="margin-top: 60px ; margin-left:90px; margin-right:90px; font-size: 22px; text-align:center; line-height: 150%;">{{texto}}</p> -->
    </div>
    <pdf:nexttemplate name="back_template" />        
    <pdf:nextpage>
    
    <div id="fundo">
        <p style="font-size: 18pt;">CERT0932</p>
    </div>

</body>
</html>
1reaction
AlcantaraGabrielcommented, May 16, 2021

@skwars7 I get it, perhaps another libary help you, search by PyPDF2 merge pdf, PISA merge pdf or WEASYPRIN merge pdf.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Switching templates in version 7.0 FAQ
It's not possible to change templates on a version 7.1 site. In version 7.0, you switch templates to get access to different features....
Read more >
Page templates in SharePoint - Microsoft Support
Create or open a page or news post that you want to use as the basis for your template. Add or change the...
Read more >
Create and use page templates in Pages on Mac
Reapply a page template · Click the View menu button in the toolbar, then choose Page Thumbnails. · Click the thumbnail image of...
Read more >
How to change the page template in WordPress
Page templates can be applied only to pages, in order to change their aspect. It can be applied to a single page, a...
Read more >
Cant find Page Template under Page attributes after ...
Did you change your theme? The Page Template selector is populated from the available page templates in the current theme. If there are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found