Forum How do I...?

how can i convert current php page?

ayan_asn
If I want to call prince to convert the page where from its called. How is that possible in PHP?. Please Help!!
mikeday
You can do this by wrapping the page in calls to ob_start() and ob_get_clean(), as described in this thread.

Edited by mikeday

ayan_asn
but problem is when using output buffering the styles go away..
mikeday
How are is the CSS specified? Using <link rel="stylesheet">, or @import, or directly inside a <style> element? Have you enabled output logging with setLog()? Is Prince emitting any error or warning messages?
ayan_asn
using link rel. setLog is enabled. but prince is not writing on that file..

Edited by ayan_asn

mikeday
PHP must lack write permissions to the log directory; can you try specifying a different location that is writable? Perhaps /tmp/prince.log, if nowhere else is available?
ayan_asn
problem solved.. I have to use absolute path of the stylesheet!! thanks
mikeday
Great! You can also specify a base URL for the document using setBaseURL(), so that URLs will be resolved relative to HTTP instead of as local files. But using an absolute file path will be faster.