'MPDF - Using more than 1 template (SetDocTemplate)
I am using MDF and trying to generate a PDF which uses either 1 or 2 external templates.
The is a PDF Form, which is 8 pages long, and a letter which is 1 page long.
The problem I have is if I include the first (optional) letter, the second pdf template starts importing from page 2.
How can I set the second template so it starts importing from the first page?
I can't use $mpdf->importPage option since the are defined within my external file
$mpdf = new Mpdf();
if ($include_cover_letter) {
$mpdf->SetDocTemplate($cover, true);
$mpdf->WriteHTML($letter_file); // external html file
}
$mpdf->SetDocTemplate($form, true);
$mpdf->WriteHTML($form_file); // external html file
$mpdf->output();
Solution 1:[1]
I think problem is your src attribute of img tag. you need to check "console tag" of browser.
If your "Images" folder is same level of your html page you can set the src location like this
It maybe works well.
Solution 2:[2]
Following is the code that you can have:
<!--Slideshow Code-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<div class="container">
<h2 class="select-none font-black">Highlights</h2>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="Christmas.png" alt="Los Angeles" style="width:100%;">
<div class="carousel-caption">
</div>
</div>
<div class="item">
<img src="agro chemicals.png" alt="Chicago" style="width:100%;">
<div class="carousel-caption">
</div>
</div>
<div class="item">
<img src="cleaning products by latan.png" alt="New York" style="width:100%;">
<div class="carousel-caption">
</div>
</div>
<div class="item">
<img src="textilesproducts by latan.png" alt="india" style="width:100%;">
<div class="carousel-caption"></div>
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Stephen Daniel |
| Solution 2 | General Grievance |
