<?php

$file=session_id();

$row=row("select * from form where id=$id");

$data='No data';

if($row){

    extract($row);

    $data="id:$id,nom:$nom $postnom $prenom,passeport:$num_passeport";

}

QRcode::png($data,"qrcode/file-$id.png");

?>

<div class="row" id="form">

    <div class="col-md-12 m-auto">

        <?php include_once 'inc.header.php'?>

    </div>

    <div class="col-12 m-auto" style="max-width:300px">

        <div class="card"><div class="card-body">

            <img width="100%" src="<?="qrcode/file-$id.png"?>" alt="">

        </div></div>

    </div>

    <div class="col-12 mt-3"></div>

    <div class="col-12 text-center"><a href="frame.php?id=<?=$id?>" class="btn-lg btn btn-danger"><?=translate('Télécharger')?></a></div>

    <div class="col-12 mt-3 text-center"><a href="./" class="btn-lg btn btn-link text-danger"><span class="fa fa-home"> </span><?=translate('Accueil')?></a></div>

    <div class="col-12 mt-5"></div>

</div>

<script>

	const button = document.getElementById('download-button');

	function generatePDF() {

		// Choose the element that your content will be rendered to.

		const element = document.getElementById('form');

		

		// Choose the element and save the PDF for your user.

		html2pdf().from(element).save();

	}

	button.addEventListener('click', generatePDF);

</script>