Forum Documentation

Looking for some php to pdf documentation..

Scooby08
I'm brand new to prince and was wondering where I could find any documentation on creating dynamic invoices.. Can prince even change .php files to PDF? I'm not finding the info I need to learn more about this and was wondering if somebody can point me to that info..

Thanks
mikeday
The Prince PHP wrapper includes methods for converting files or strings into PDF. However, you probably have some PHP pages generating invoices for the browser, and you want to return a PDF instead. We don't yet offer a one-line call to do this, but it should be possible to do it using the ob_start and ob_get_clean functions, like this:
<?php

ob_start();

// your code to generate invoice HTML goes here

$out = ob_get_clean();

$prince = new Prince('/usr/bin/prince');

$prince->setHTML(1);
$prince->setLog('/tmp/prince.log');

header('Content-type: application/pdf');

$prince->convert_string_to_passthru($out);
?>

The ob_start function begins output buffering, so PHP will buffer up the HTML internally instead of returning it to the browser, then ob_get_clean wipes the buffer and returns it as a string so that the generated HTML can be converted to PDF by Prince and the PDF returned to the browser with an appropriate content-type so that the browser knows what to do with it.

How is that? :D
malkativlr
Is there any php function that will get HTTP_POST_VARS and each var to some array?

For example:
_POSTvariable1==value1;
_POSTvariable2==value2;

The function should return arrayvariable1=value1 and arrayvariable2=value2
mikeday
Not sure what you are asking, how to use the $_POST array? The PHP documentation should cover this, just google for "$_POST".
ayan_asn
but when i am doing what u have told the css styling is missing... !!!
mikeday
Can we take this back to the other thread? Otherwise it will get very confusing. :)
ajmal
I have to create a pdf file and dynamically save it to a fixed directory other than downloads and then after , i have to dynamically mail it to an address which has to be fetched from my database .
I'm using fpdf for pdf generation . .
Is this possible ? how ?
mikeday
I think this is a PHP question, or possibly an FPDF question, not a Prince question. So you might want to take this to StackOverflow, or a PHP forum.
ajmal
ok . thanks for the help ,