⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.101
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
Server Software:
Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.25
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
taxi.dev-unit.com
/
resources
/
js
/
View File Name :
pdf_conversion_script.js
// Function to generate and send PDF function generateAndSendPDF() { // HTML content to convert to PDF var htmlContent = "<h1>Hello World</h1>"; // Conversion options var conversionOptions = { html: htmlContent, allowLocalFilesAccess: true, waitForJS: true, waitForJSVarName: 'PHANTOM_HTML_TO_PDF_READY', // Custom variable name for programmatic PDF printing viewportSize: { width: 800, height: 600 }, format: { quality: 100 }, header: '<h2>This is the header</h2>', // Custom header footer: '<div style="text-align:center">{#pageNum}/{#numPages}</div>' // Custom footer with page numbers }; // Load the phantom-html-to-pdf script from CDN var script = document.createElement('script'); script.src = "https://cdn.jsdelivr.net/npm/phantom-html-to-pdf@0.8.3/index.min.js"; document.head.appendChild(script); // Wait for the script to load script.onload = function() { console.log('Script loaded successfully'); // Perform the conversion once the script is loaded var conversion = phantomHtmlToPdf(conversionOptions, function(err, pdf) { if (err) { console.error('Error generating PDF:', err); } else { // Output PDF details console.log('PDF logs:', pdf.logs); console.log('Number of pages:', pdf.numberOfPages); // Create a blob URL for the PDF var pdfBlob = new Blob([pdf.output], { type: 'application/pdf' }); var pdfUrl = URL.createObjectURL(pdfBlob); // Open the PDF in a new tab window.open(pdfUrl); // Cleanup URL.revokeObjectURL(pdfUrl); } }); }; // Log when the function is called console.log('Function called'); } // Call the function to generate and send PDF generateAndSendPDF();