>', '<< /Type /Pages /Kids [3 0 R] /Count 1 >>', '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 600 100] /Resources << /Font << /F1 4 0 R >> >> /Contents 5 0 R >>', '<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>', '<< /Length '.strlen($stream)." >>\nstream\n".$stream."\nendstream", ]; $pdf = "%PDF-1.4\n% Synthetic QA original\n"; $offsets = []; foreach ($objects as $index => $object) { $offsets[] = strlen($pdf); $pdf .= ($index + 1)." 0 obj\n".$object."\nendobj\n"; } $xref = strlen($pdf); $pdf .= "xref\n0 6\n0000000000 65535 f \n"; foreach ($offsets as $offset) { $pdf .= sprintf('%010d 00000 n ', $offset)."\n"; } return $pdf."trailer\n<< /Size 6 /Root 1 0 R >>\nstartxref\n".$xref."\n%%EOF\n"; } }