Jump to content

Pear PDF and custom wrapper class issues


theinfamousmielie

Recommended Posts

Okay, yet another insurmountable one to tease your brains.

 

Before I start, you should know that I _COULD_ extend the entire class, but that would defeat my purpose of 'simplifying' for the novice developer. Anyway ... here goes.

 

As it stands i have a PDF controller which does its thing very well in acting as the middleman to PEAR's File_PDF class.

 

However, it is not acting as an 'extended' class, it is its own class. The core function: CreateDocument() does the following:

$this->PDFLink = &File_PDF::factory(array('orientation' => $Orientation, 'unit' => $this->Unit, 'format' => $this->PageSize), $this->ExtensionClass); 

 

okay so this is fine, and works well on every single thing except where i need to override a function as originally defined in PEAR's PDF class (File_PDF)

 

The two functions in particular? header() and footer() ...

 

Is there a way for me to extend in such a way as that i have the ability to 'redefine' the header() and footer() functions in a way similar to below:

 

//$PDF = new PDFController; // my 'middleman' pdf controller

class MyPDF extends PDFController {  // PDFController does not extend to anything but instead calls File_PDF::factory() within one of it's functions.

    function header() {
        //overwrites PEAR function defined in File_PDF class
    }

}

$PDF = new MyPDF;
$PDF->CreateDocument();
$PDF->AddPage(); // adds a page with included styles etc from header() and footer() functions

 

Any ideas? I realise this could be impossible, but you never know, someone might know something i dont. :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.