|
Posted by Dennis de Wit on 08/21/06 12:05
Dennis de Wit wrote:
> wesley@ispace.co.za wrote:
>> Hi all, a question about the follwing code segment was proposed about a
>> year ago, but there was no resolution. The code works for some but not
>> others. It does not work for me, please tell me why.:
>>
>> Thanks in advance
>> Wes
>>
>> <?
>> $pdf = pdf_new();
>> pdf_open_file($pdf);
>> pdf_set_info($pdf, "author", "test auth");
>> pdf_set_info($pdf, "title", "test page");
>> pdf_set_info($pdf, "creator", "test creator");
>> pdf_set_info($pdf, "subject", "Online test");
>> pdf_begin_page($pdf, 450, 450);
>>
>> $font = pdf_findfont($pdf, "Times-Roman", "winansi",0);
>>
>> pdf_setfont($pdf, $font, 12);
>> pdf_show_xy($pdf, "test text", 5, 20);
>>
>> pdf_end_page($pdf);
>> pdf_close($pdf);
>> $buffer = pdf_get_buffer($pdf);
>> header("Content-type: application/pdf");
>> header("Content-Length: ".strlen($buffer));
>> header("Content-Disposition: inline; filename=test.pdf");
>>
>> echo $buffer;
>> pdf_delete($pdf);
>>
>> ?>
>> Thanks
>>
>
> What's going wrong then?
>
> please give some more info
Try swapping these lines:
pdf_close($pdf);
$buffer = pdf_get_buffer($pdf);
by making them into
$buffer = pdf_get_buffer($pdf);
pdf_close($pdf);
.... does that help?
Navigation:
[Reply to this message]
|