composer require dompdf/dompdf
Created
March 24, 2026 07:46
-
-
Save stnc/e45f69906e51172a70661b535b351466 to your computer and use it in GitHub Desktop.
Creating PDFs with PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="tr"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>NanoTR-19 Sertifika</title> | |
| <style> | |
| @page { | |
| size: A4 landscape; | |
| margin: 1cm; | |
| } | |
| * { | |
| box-sizing: border-box; | |
| } | |
| body { | |
| font-family: 'Times New Roman', serif; | |
| background: white; | |
| margin: 0; | |
| padding: 20px; | |
| width: 29.7cm; | |
| height: 21cm; | |
| overflow: hidden; | |
| position: relative; | |
| page-break-after: avoid; | |
| } | |
| .certificate-container { | |
| width: 100%; | |
| height: 100%; | |
| background: white; | |
| border: 5px dashed #ccc; | |
| padding: 30px; | |
| position: relative; | |
| box-shadow: 0 0 20px rgba(0,0,0,0.3); | |
| } | |
| .banner-img { | |
| width: 100%; | |
| height: 80px; | |
| object-fit: cover; | |
| margin-bottom: 15px; | |
| display: block; | |
| } | |
| .header { | |
| text-align: center; | |
| margin-bottom: 20px; | |
| } | |
| .title { | |
| font-size: 32px; | |
| font-weight: bold; | |
| color: #000; | |
| margin-bottom: 8px; | |
| text-transform: uppercase; | |
| } | |
| .conference-info { | |
| font-size: 20px; | |
| color: #333; | |
| font-style: italic; | |
| } | |
| .content { | |
| text-align: center; | |
| margin: 30px 0; | |
| flex-grow: 1; | |
| display: flex; | |
| flex-direction: column; | |
| justify-content: center; | |
| } | |
| .participation-text { | |
| font-size: 18px; | |
| margin-bottom: 20px; | |
| line-height: 1.4; | |
| } | |
| .name { | |
| font-size: 44px; | |
| font-weight: bold; | |
| color: #000; | |
| text-transform: uppercase; | |
| letter-spacing: 2px; | |
| margin: 10px 0; | |
| } | |
| .chairs { | |
| display: flex; | |
| justify-content: space-between; | |
| margin-top: 40px; | |
| margin-bottom: 20px; | |
| } | |
| .chair { | |
| text-align: center; | |
| flex: 1; | |
| padding: 0 10px; | |
| } | |
| .chair-title { | |
| font-weight: bold; | |
| color: #333; | |
| font-size: 14px; | |
| margin-bottom: 5px; | |
| text-transform: uppercase; | |
| } | |
| .chair-name { | |
| font-size: 20px; | |
| font-weight: bold; | |
| margin: 5px 0; | |
| color: #000; | |
| } | |
| .university { | |
| font-size: 16px; | |
| color: #666; | |
| font-style: italic; | |
| } | |
| .date-location { | |
| text-align: center; | |
| font-size: 18px; | |
| font-style: italic; | |
| margin: 20px 0; | |
| } | |
| .footer-text { | |
| text-align: center; | |
| font-size: 16px; | |
| font-style: italic; | |
| color: #666; | |
| line-height: 1.4; | |
| margin-top: auto; | |
| } | |
| @media print { | |
| body { | |
| margin: 0; | |
| padding: 0; | |
| } | |
| .certificate-container { | |
| box-shadow: none; | |
| border: 3px solid #000; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="certificate-container"> | |
| <img src="http://helix.test/wp-content/uploads/2026/03/Screenshot-2026-03-24-at-1.17.34-AM.png" alt="NanoTR-19 Banner" class="banner-img">[file:2] | |
| <div class="header"> | |
| <div class="title">NANOTR-19 - Certificate of Appreciation</div> | |
| <div class="conference-info">19th International Nanoscience and Nanotechnology Conference</div> | |
| </div> | |
| <div class="content"> | |
| <div class="participation-text"> | |
| Has actively participated in the 19th International Nanoscience and Nanotechnology Conference NanoTR-19 | |
| </div> | |
| <div class="name">Abdul Muhaymin</div> | |
| </div> | |
| <div class="chairs"> | |
| <div class="chair"> | |
| <div class="chair-title">Co-Chair</div> | |
| <div class="chair-name">Prof. Dr. H. Emrah Şaban</div> | |
| <div class="university">Middle East Technical University</div> | |
| </div> | |
| <div class="chair"> | |
| <div class="chair-title">Co-Chair</div> | |
| <div class="chair-name">Prof. Dr. Ali Erçpan</div> | |
| <div class="university">Middle East Technical University</div> | |
| </div> | |
| <div class="chair"> | |
| <div class="chair-title">Co-Chair</div> | |
| <div class="chair-name">Prof. Dr. Batur Ercan</div> | |
| <div class="university">Middle East Technical University</div> | |
| </div> | |
| </div> | |
| <div class="date-location"> | |
| Middle East Technical University (METU), Ankara, on August 27-29, 2025.[file:1] | |
| </div> | |
| <div class="footer-text"> | |
| We greatly appreciate your participation and hope the insights gained at the conference enrich your research and contributions in the fields of nanoscience and nanotechnology.[file:1] | |
| </div> | |
| </div> | |
| </body> | |
| </html> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require __DIR__ . '/vendor/autoload.php'; | |
| use Dompdf\Dompdf; | |
| use Dompdf\Options; | |
| $options = new Options(); | |
| $options->set('isRemoteEnabled', true); | |
| $options->set('isHtml5ParserEnabled', true); | |
| $dompdf = new Dompdf($options); | |
| $html = <<<HTML | |
| <!DOCTYPE html> | |
| <html lang="tr"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>NanoTR-19 Sertifika</title> | |
| <style> | |
| body { | |
| font-family: 'Times New Roman', serif; | |
| background: white; | |
| margin: 0; | |
| padding: 20px; | |
| width: 29.7cm; | |
| height: 21cm; | |
| overflow: hidden; | |
| position: relative; | |
| page-break-after: avoid; | |
| } | |
| .certificate-container { | |
| width: 100%; | |
| height: 100%; | |
| background: white; | |
| border: 5px dashed #ccc; | |
| padding: 30px; | |
| position: relative; | |
| box-shadow: 0 0 20px rgba(0,0,0,0.3); | |
| } | |
| .banner-img { | |
| width: 100%; | |
| height: 80px; | |
| object-fit: cover; | |
| margin-bottom: 15px; | |
| display: block; | |
| } | |
| .header { | |
| text-align: center; | |
| margin-bottom: 20px; | |
| } | |
| .title { | |
| font-size: 32px; | |
| font-weight: bold; | |
| color: #000; | |
| margin-bottom: 8px; | |
| text-transform: uppercase; | |
| } | |
| .conference-info { | |
| font-size: 20px; | |
| color: #333; | |
| font-style: italic; | |
| } | |
| .content { | |
| text-align: center; | |
| margin: 30px 0; | |
| flex-grow: 1; | |
| display: flex; | |
| flex-direction: column; | |
| justify-content: center; | |
| } | |
| .participation-text { | |
| font-size: 18px; | |
| margin-bottom: 20px; | |
| line-height: 1.4; | |
| } | |
| .name { | |
| font-size: 44px; | |
| font-weight: bold; | |
| color: #000; | |
| text-transform: uppercase; | |
| letter-spacing: 2px; | |
| margin: 10px 0; | |
| } | |
| .chairs { | |
| display: flex; | |
| justify-content: space-between; | |
| margin-top: 40px; | |
| margin-bottom: 20px; | |
| } | |
| .chair { | |
| text-align: center; | |
| flex: 1; | |
| padding: 0 10px; | |
| } | |
| .chair-title { | |
| font-weight: bold; | |
| color: #333; | |
| font-size: 14px; | |
| margin-bottom: 5px; | |
| text-transform: uppercase; | |
| } | |
| .chair-name { | |
| font-size: 20px; | |
| font-weight: bold; | |
| margin: 5px 0; | |
| color: #000; | |
| } | |
| .university { | |
| font-size: 16px; | |
| color: #666; | |
| font-style: italic; | |
| } | |
| .date-location { | |
| text-align: center; | |
| font-size: 18px; | |
| font-style: italic; | |
| margin: 20px 0; | |
| } | |
| .footer-text { | |
| text-align: center; | |
| font-size: 16px; | |
| font-style: italic; | |
| color: #666; | |
| line-height: 1.4; | |
| margin-top: auto; | |
| } | |
| @media print { | |
| body { | |
| margin: 0; | |
| padding: 0; | |
| } | |
| .certificate-container { | |
| box-shadow: none; | |
| border: 3px solid #000; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="certificate-container"> | |
| <img src="http://helix.test/wp-content/uploads/2026/03/Screenshot-2026-03-24-at-1.17.34-AM.png" alt="NanoTR-19 Banner" class="banner-img">[file:2] | |
| <div class="header"> | |
| <div class="title">NANOTR-19 - Certificate of Appreciation</div> | |
| <div class="conference-info">19th International Nanoscience and Nanotechnology Conference</div> | |
| </div> | |
| <div class="content"> | |
| <div class="participation-text"> | |
| Has actively participated in the 19th International Nanoscience and Nanotechnology Conference NanoTR-19 | |
| </div> | |
| <div class="name">Abdul Muhaymin</div> | |
| </div> | |
| <div class="chairs"> | |
| <div class="chair"> | |
| <div class="chair-title">Co-Chair</div> | |
| <div class="chair-name">Prof. Dr. H. Emrah Şaban</div> | |
| <div class="university">Middle East Technical University</div> | |
| </div> | |
| <div class="chair"> | |
| <div class="chair-title">Co-Chair</div> | |
| <div class="chair-name">Prof. Dr. Ali Erçpan</div> | |
| <div class="university">Middle East Technical University</div> | |
| </div> | |
| <div class="chair"> | |
| <div class="chair-title">Co-Chair</div> | |
| <div class="chair-name">Prof. Dr. Batur Ercan</div> | |
| <div class="university">Middle East Technical University</div> | |
| </div> | |
| </div> | |
| <div class="date-location"> | |
| Middle East Technical University (METU), Ankara, on August 27-29, 2025.[file:1] | |
| </div> | |
| <div class="footer-text"> | |
| We greatly appreciate your participation and hope the insights gained at the conference enrich your research and contributions in the fields of nanoscience and nanotechnology.[file:1] | |
| </div> | |
| </div> | |
| </body> | |
| </html> | |
| HTML; | |
| $dompdf->loadHtml($html); | |
| $dompdf->setPaper('A4', 'landscape'); | |
| $dompdf->render(); | |
| $dompdf->stream('rapor.pdf', ['Attachment' => false]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment