public function __construct($i)
{
// Use default settings for a new PDF object.
if (is_int($i)) {
$this->index = $i;
$this->data = "\n[{obj_index}] 0 obj\n[{obj_def}]\n[{obj_stream}]\nendobj\n\n";
} else {
if (is_string($i)) {
// Else, determine the object index.
$this->index = substr($i, 0, strpos($i, ' '));
// Determine the objects definition and stream, if applicable.
$s = substr($i, strpos($i, ' obj') + 4);
$s = substr($s, 0, strpos($s, 'endobj'));
if (strpos($s, 'stream') !== false) {
$def = substr($s, 0, strpos($s, 'stream'));
$str = substr($s, strpos($s, 'stream') + 6);
$str = substr($str, 0, strpos($str, 'endstream'));
$this->define($def);
$this->setStream($str);
} else {
$this->define($s);
}
if (stripos($this->def, '/flatedecode') !== false) {
$this->isCompressed = true;
}
if (stripos($this->def, '/xobject') !== false) {
$this->isXObject = true;
}
$this->data = "\n[{obj_index}] 0 obj\n[{obj_def}]\n[{obj_stream}]\nendobj\n\n";
}
}
}