Manual:Extension/PDFCreator/Custom cover sheets: Difference between revisions

No edit summary
Tag: 2017 source edit
No edit summary
Line 7: Line 7:
Changing the cover page from the page ''Special:PDF templates'' will overwrite your changes.|icon=yes}}
Changing the cover page from the page ''Special:PDF templates'' will overwrite your changes.|icon=yes}}


'''To create a new PDF template:'''
== Copying an existing template ==
To create a PDF template with a custom cover sheet, we first copy an existing template. For the example we copy the ''StandardBookPDF'' template to a new template called ''StandardHandbookPDF''.
 
'''To create a new PDF template from an existing one:'''


# '''Go''' to the page ''Special:PDF_templates''.
# '''Go''' to the page ''Special:PDF_templates''.
# '''Copy''' an existing template.[[File:PDF templates - copy.png|alt=special page "PDF templates" with selected standard book pdf to be copied|center|thumb|600x600px|Copy a template]]
# '''Copy''' the template ''StandardBookPDF''.[[File:PDF templates - copy.png|alt=special page "PDF templates" with selected standard book pdf to be copied|center|thumb|600x600px|Copy a template]]
# '''Enter''' a name for the new template.
# '''Enter''' a name for the new template.
# '''Click''' ''Copy.''<noinclude>
# '''Click''' ''Copy.''
 
== Customizing the template ==
From the page ''Special:PDF_templates'' click on the template name for your new template. ''StandardHandbookPDF''. This brings up the page MediaWiki:PDFCreator.
 
To customize the cover sheet:
 
# '''Select''' your PDF template. This brings up the PDFCreator page for your template.
# '''Open''' the page in edit mode.
# '''Switch''' to the tab ''Document preface''.
# '''Replace''' the default content with the following content:<syntaxhighlight lang="css">
<div class="pdfcreator-bgplain"></div>
<div class="pdfcreator-intro">
    <div class="pdfcreator-intro-logo">{{{logo}}}</div>
    <div class="pdfcreator-intro-title">{{{book-title}}}
        <div class="pdfcreator-intro-subtitle">{{{book-subtitle}}}</div>
</div>
 
    <div class="pdfcreator-intro-text">
        <div>Adress line 1</div>
        <div>Adress line 2</div>
        <div>City</div>
        <div>Other contact info</div>
    </div>
</div>
</syntaxhighlight>
# '''Switch''' to the tab ''Styles''.
# '''Append''' the following CSS rules to the end of the existing CSS styles.<syntaxhighlight lang="css">
.pdfcreator-type-intro {
page: coverpage;
background-size: 21cm;
width: 21cm;
height: 29.7cm;
background-repeat: no-repeat;
}
 
.pdfcreator-intro-title {
position: absolute;
top: 15.5cm;
left: 1.75cm;
width: 17.5cm;
max-height: 6.5cm;
overflow: hidden;
font-size: 32px;
color: #3E5389;
font-weight: 800;
line-height: 1.5em;
}
 
.pdfcreator-intro-subtitle {
    display:block;
font-size: 18px;
color: #3E5389;
font-weight: 600;
line-height: 1.3em;
margin-top:0.5cm;
}
 
.pdfcreator-intro-text {
    position:absolute;
font-size: 14px;
font-weight: 600;
line-height: 1.3em;
    top:25.5cm;
    left:1.75cm;
width: 17.5cm;
}
 
.pdfcreator-intro-logo {
position: absolute;
padding: 0.3cm 1.75cm;
width: 21cm;
max-height: 2.6cm;
overflow: hidden;
background-color: #ffffff;
}
 
.pdfcreator-bgplain {
    position:absolute;
    z-index:-1;
    height:12cm;
    width:21cm;
    background: #3E5389;
}
 
.pdfcreator-type-intro {
background-position:center 1.5cm;
/* first value: width of the image, second value: height */
    max-height:14cm;
    overflow:hidden;
}
</syntaxhighlight>[[File:Extension PDFCreator template page.png|alt=Code view of the template example "StandardHandbookPDF"|center|thumb|650x650px|PDFCreator template page]]

Revision as of 08:53, 21 October 2025


To create a custom cover sheet with more than just the title and a background, you need to add some custom formatting to a PDF template.

Customizing the cover sheet

Cover page with logo, background image, title, subtitle and contact information
Custom cover page
Important!

When you customize the cover sheet as described, you need to maintain it exclusively via the page MediaWiki:PDFCreator.

Changing the cover page from the page Special:PDF templates will overwrite your changes.


Copying an existing template

To create a PDF template with a custom cover sheet, we first copy an existing template. For the example we copy the StandardBookPDF template to a new template called StandardHandbookPDF.

To create a new PDF template from an existing one:

  1. Go to the page Special:PDF_templates.
  2. Copy the template StandardBookPDF.
    special page "PDF templates" with selected standard book pdf to be copied
    Copy a template
  3. Enter a name for the new template.
  4. Click Copy.

Customizing the template

From the page Special:PDF_templates click on the template name for your new template. StandardHandbookPDF. This brings up the page MediaWiki:PDFCreator.

To customize the cover sheet:

  1. Select your PDF template. This brings up the PDFCreator page for your template.
  2. Open the page in edit mode.
  3. Switch to the tab Document preface.
  4. Replace the default content with the following content:
    <div class="pdfcreator-bgplain"></div>
    <div class="pdfcreator-intro">
        <div class="pdfcreator-intro-logo">{{{logo}}}</div>
        <div class="pdfcreator-intro-title">{{{book-title}}}
            <div class="pdfcreator-intro-subtitle">{{{book-subtitle}}}</div>
    	</div>
    
        <div class="pdfcreator-intro-text">
            <div>Adress line 1</div>
            <div>Adress line 2</div>
            <div>City</div>
            <div>Other contact info</div>
        </div>
    </div>
    
  5. Switch to the tab Styles.
  6. Append the following CSS rules to the end of the existing CSS styles.
    .pdfcreator-type-intro {
    	page: coverpage;
    	background-size: 21cm;
    	width: 21cm;
    	height: 29.7cm;
    	background-repeat: no-repeat;
    }
    
    .pdfcreator-intro-title {
    	position: absolute;
    	top: 15.5cm;
    	left: 1.75cm;
    	width: 17.5cm;
    	max-height: 6.5cm;
    	overflow: hidden;
    	font-size: 32px;
    	color: #3E5389;
    	font-weight: 800;
    	line-height: 1.5em;
    }
    
    .pdfcreator-intro-subtitle {
        display:block;
    	font-size: 18px;
    	color: #3E5389;
    	font-weight: 600;
    	line-height: 1.3em;
    	margin-top:0.5cm;
    }
    
    .pdfcreator-intro-text {
        position:absolute;
    	font-size: 14px;
    	font-weight: 600;
    	line-height: 1.3em;
        top:25.5cm;
        left:1.75cm;
    	width: 17.5cm;
    }
    
    .pdfcreator-intro-logo {
    	position: absolute;
    	padding: 0.3cm 1.75cm;
    	width: 21cm;
    	max-height: 2.6cm;
    	overflow: hidden;
    	background-color: #ffffff;
    }
    
    .pdfcreator-bgplain {
        position:absolute;
        z-index:-1;
        height:12cm;
        width:21cm;
        background: #3E5389;
    }
    
    .pdfcreator-type-intro {
    	background-position:center 1.5cm;
    	/* first value: width of the image, second value: height */
        max-height:14cm;
        overflow:hidden; 
    }
    
    Code view of the template example "StandardHandbookPDF"
    PDFCreator template page



PDF exclude - start

To submit feedback about this documentation, visit our community forum.

PDF exclude - end