119 lines
6.0 KiB
PHP
119 lines
6.0 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
@include('layouts.shared/title-meta', ['title' => "Form"])
|
|
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
|
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="account-pages mt-2 mb-2">
|
|
<div class="container">
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-8 col-lg-6 col-xl-5">
|
|
<div class="card bg-pattern">
|
|
@if(isset($pdf_file) && $pdf_file != '')
|
|
<div class="card-body p-1">
|
|
<iframe src="/storage/{{$folder}}{{$pdf_file}}" style="border: none; width: 100%; height:70vh;"></iframe>
|
|
<div class="text-center">
|
|
<p class="text-muted font-14 mt-2"> Now click below button to download the PDF</p>
|
|
<a href="/storage/{{$folder}}{{$pdf_file}}" download class="btn btn-primary waves-effect waves-light mt-3">Download PDF</a>
|
|
<!-- <a href="/" class="btn btn-dark waves-effect waves-light mt-3">Homepage</a> -->
|
|
</div>
|
|
</div> <!-- end card-body -->
|
|
@endif
|
|
|
|
|
|
@foreach($images as $image)
|
|
@if(isset($form_info['link']))
|
|
<div class="card-body p-1" >
|
|
<div class="text-center" id="pdf-content">
|
|
<a href="{{ 'https://'.str_replace('http://','',str_replace('https://','',$form_info['link']))}}" target="_blank">
|
|
<div class="text-center" >
|
|
<img src="/storage/{{$folder}}{{$image}}" id="img-content" class="img-fluid mx-auto">
|
|
</div>
|
|
</a>
|
|
</div>
|
|
<div class="text-center">
|
|
<p class="text-muted font-14 mt-2"> Now click below button to download</p>
|
|
|
|
<!-- <a href="/storage/{{$folder}}{{$image}}" download class="btn btn-primary waves-effect waves-light mt-3">Download Image</a> -->
|
|
<button type="button" id="download-pdf-result-btn" class="btn btn-primary waves-effect waves-light mt-3">Download PDF</button>
|
|
<!-- <a href="/" class="btn btn-dark waves-effect waves-light mt-3">Homepage</a> -->
|
|
</div>
|
|
</div> <!-- end card-body -->
|
|
@else
|
|
<div class="card-body p-1">
|
|
<img src="/storage/{{$folder}}{{$image}}" class="img-fluid">
|
|
<div class="text-center">
|
|
<p class="text-muted font-14 mt-2"> Now click below button to download </p>
|
|
<a href="/storage/{{$folder}}{{$image}}" download class="btn btn-primary waves-effect waves-light mt-3">Download Image</a>
|
|
<!-- <a href="/" class="btn btn-dark waves-effect waves-light mt-3">Homepage</a> -->
|
|
</div>
|
|
</div> <!-- end card-body -->
|
|
@endif
|
|
@endforeach
|
|
</div>
|
|
<!-- end card -->
|
|
|
|
</div> <!-- end col -->
|
|
</div>
|
|
<!-- end row -->
|
|
</div>
|
|
<!-- end container -->
|
|
</div>
|
|
<!-- end page -->
|
|
@include('layouts.shared/footer-script')
|
|
<!-- html2pdf js -->
|
|
<script
|
|
src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"
|
|
integrity="sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg=="
|
|
crossorigin="anonymous"
|
|
referrerpolicy="no-referrer"
|
|
></script>
|
|
|
|
<script type="text/javascript">
|
|
jQuery(document).ready(function ($) {
|
|
let download_btn = document.getElementById("download-pdf-result-btn");
|
|
$(download_btn).on("click", function (e) {
|
|
console.log("download_btn clicked...", e);
|
|
let element = document.getElementById("pdf-content");
|
|
console.log("element = ", element);
|
|
let pdf_file_name = `generated-activation-invite-${(new Date().toJSON().slice(0,10))}.pdf`;
|
|
// "generated-activation-invite.pdf"
|
|
//Option..
|
|
let opt = {
|
|
margin: [0, 15],
|
|
filename: pdf_file_name,
|
|
image: { type: "png", quality: 0.98 },
|
|
html2canvas: {
|
|
scrollX: 0,
|
|
scrollY: 0,
|
|
dpi: 300,
|
|
letterRendering: true,
|
|
useCORS: true,
|
|
// scale: 0.9,
|
|
},
|
|
jsPDF: {
|
|
// unit: "px",
|
|
// hotfixes: ["px_scaling"],
|
|
format: "legal",
|
|
orientation: "p",
|
|
},
|
|
enableLinks: true,
|
|
};
|
|
//Call html2pdf
|
|
// html2pdf(element, opt);
|
|
//Proise based
|
|
html2pdf().set(opt).from(element).save();
|
|
console.log("I am executed after html2pdf call...");
|
|
})
|
|
})
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|