Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.5 kB
3
Indexable
Never
<?php

$header = "%PDF-1.4\n";
$header .= "1 0 obj\n";
$header .= "<< /Type /Catalog\n";
$header .= "/Pages 2 0 R >>\n";
$header .= "endobj\n";
$header .= "2 0 obj\n";
$header .= "<< /Type /Pages\n";
$header .= "/Kids [3 0 R]\n";
$header .= "/Count 1 >>\n";
$header .= "endobj\n";
$header .= "3 0 obj\n";
$header .= "<< /Type /Page\n";
$header .= "/Parent 2 0 R\n";
$header .= "/Resources << /Font << /F1 4 0 R >> >>\n";
$header .= "/MediaBox [0 0 612 792] >>\n";
$header .= "endobj\n";
$header .= "4 0 obj\n";
$header .= "<< /Type /Font\n";
$header .= "/Subtype /Type1\n";
$header .= "/BaseFont /Helvetica\n";
$header .= "/Encoding /WinAnsiEncoding >>\n";
$header .= "endobj\n";
$header .= "xref\n";
$header .= "0 5\n";
$header .= "0000000000 65535 f \n";
$header .= "0000000010 00000 n \n";
$header .= "0000000058 00000 n \n";
$header .= "0000000116 00000 n \n";
$header .= "trailer\n";
$header .= "<< /Size 5\n";
$header .= "/Root 1 0 R\n";
$header .= ">>\n";
$header .= "startxref\n";
$header .= "170\n";
$header .= "%%EOF";

$body = "3 0 obj\n";
$body .= "<< /Length 54 >>\n";
$body .= "stream\n";
$body .= "BT\n";
$body .= "/F1 24 Tf\n";
$body .= "100 500 Td\n";
$body .= "(Hello, World!) Tj\n";
$body .= "ET\n";
$body .= "endstream\n";
$body .= "endobj\n";

$pdf_content = $header . "\n" . $body;

$file_name = 'example.pdf';
$file_handle = fopen($file_name, 'w');
fwrite($file_handle, $pdf_content);
fclose($file_handle);

echo "PDF created: $file_name";
?>
Leave a Comment