[dev] PDF-creation

Marko Djukic mdjukic at horde.org
Tue May 18 09:42:44 PDT 2004



try with these changes:

$x = &wpPDF :: factory ('P', 'mm', 'A4');

$x->setinfo ('title', 'FOOOODOOOO');
$x->setinfo ('subject', 'The Subject field :-)');
$x->setinfo ('creator', 'Not mine');

$x->open ();
$x->setMargins (50, 50);
$x->addPage ('P');
$x->setFont('arial', '', 15);
$x->write (10, "This is some text\n");
$x->write (10, "And this is some more text\n***\n");

$x->text (10,20,'Hello');
$x->close ();
$x->save ('foo.pdf');
$x->output ('xxx.pdf', 'true');

some notes:
- your margins 150,150 were huge - 15+15cm? that's more than the width of an
a4...
- if you want \n to go through correctly enclose them in ""
- setFont at the moment seems to have an effect only after addPage() and
setFont() is required for a pdf to render properly

m.


Quoting Joaquim Homrighausen <joho at webbplatsen.se>:

>
> The resulting file, foo.pdf, cannot be read by Acrobat 6.. it says "unknown
> object". Furthermore, the $x->output does not cause MSIE/Firefox to invoke
> the
> Acrobat Reader.
>
> wpPDF is simply a class wpPDF extends File_PDF ..
>
> (This is from framework-HEAD, today's..)
>
> What am I doing wrong?
>
>
> $x = &wpPDF :: factory ('P', 'mm', 'A4');
> $x->setFont('arial', '', 15);
>
> $x->setinfo ('title', 'FOOOODOOOO');
> $x->setinfo ('subject', 'The Subject field :-)');
> $x->setinfo ('creator', 'Not mine');
>
> $x->open ();
> $x->setMargins (150, 150);
> $x->addPage ('P');
> $x->write (10, 'This is some text\n');
> $x->write (10, 'And this is some more text\n***\n');
>
> $x->text (10,20,'Hello');
> $x->close ();
> $x->save ('foo.pdf');
> $x->output ('xxx.pdf', 'true');
>
>
> -Joaquim
- your margins 150,150 were huge - 15+15cm? that's more than the width of an
a4...
- your margins 150,150 were huge - 15+15cm? that's more than the width of an
a4...
- your margins 150,150 were huge - 15+15cm? that's more than the width of an
a4...
>
> --
> Horde developers mailing list - Join the hunt: http://horde.org/bounties/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>


--
Marko Djukic
Horde Project (http://horde.org)


More information about the dev mailing list