Register Lost your password?
Full api documentation: full api documentation FREE version full api documentation PRO version

public function generatePDF()

return

  • PDF


Examples

Example 1


require_once 'classes/TransformDoc.inc';

$document = new TransformDoc();
$document->setStrFile('Text.docx');
$document->generatePDF();

    14 Responses

  • suganthi

    this can’t working fGeneratePDF -

    some error how to rectify
    Warning: ZipArchive::getFromName() [ziparchive.getfromname]: Invalid or unitialized Zip object in D:\NPIDocRoot\phpdocx_free\php5\classes\cTransformDoc.inc on line 91

    Notice: Trying to get property of non-object in D:\NPIDocRoot\phpdocx_free\php5\classes\cTransformDoc.inc on line 93

  • jorge

    Hi, the file

    $objDocument->setStrFile(’../docx/file.docx’);

    must exists to generate a PDF.
    Maybe that’s the error.

  • Jana

    In the zip file that was downloaded, a file by name ZipArchive.inc is supposed to exists under classes\ dir. This isn’t the case and that why we are getting errors. here is my php error.log:

    [14-Jan-2010 14:24:04] PHP Fatal error: require_once(): Failed opening required ‘C:\downloads\phpdocx_free\php5\classes\ZipArchive.inc’ (include_path=’.;C:\php5\pear’) in C:\downloads\phpdocx_free\php5\classes\cCreateDocx.inc on line 8

    I don’t have this file. Where can I get it?

  • nico

    @Jana

    install the php_zip and the php_xsl extensions ;)

  • Raphael

    cTransformDoc.inc

    pdf/include/tidy.cls.php error not found class

  • ocsi

    tidy.cls.php not found. Any Idea?

  • ocsi

    The answer is:

    extension=php_tidy.dll

    at php.ini… :D

  • Istvan Szente-Varadi

    Hello I get this error:

    Warning: ZipArchive::extractTo(): Invalid argument in D:\www\WK-debug\lib\phpdoc
    x\php5\classes\cTransformDoc.inc on line 149

    Fatal error: Class ‘DOMPDF’ not found in D:\www\WK-debug\lib\phpdocx\php5\classe
    s\cTransformDoc.inc on line 159

    Thanks for helping.

  • Charles

    I’m using Symfony, and i get this error

    Fatal error: Class ‘cTransformDoc’ not found, i have already clear cache, and included the library, do i need any php extension to make it works??

  • jolyon2000

    Just run the following code:

    require_once(’../library/phpdocx/classes/cTransformDoc.inc’);
    $objDocument = new cTransformDoc();
    $objDocument->setStrFile(’../library/phpdocx/examples/files/Text.docx’);
    $objDocument->fGeneratePDF();

    get this error…

    Notice: Undefined offset: 1 in \library\phpdocx\classes\cTransformDoc.inc on line 68
    Unable to stream pdf: headers already sent

    (note, i have changed the path for security reasons and can confirm that everyhting is in the correct place)

    Any ideas?

  • nschulze

    @jolyon2000
    open class.pdf.php on line 2844 and have a look at the stream function.

    put this in front of the ” if( header_sent()) ” line

    echo ”;
    var_dump(headers_list());
    die();

    to see which headers have already been send.

    no output at ALL should be before your fGeneratePDF(); call

  • yson

    Hi,

    Is there a way to generate the pdf and save it on the server instead of streaming it over?

  • overcubes

    Hi,

    When I try to convert a doc with graphics, the function does not transform to pdf.

    This function is only for text?

  • webcto

    Is it possible to convert to .doc, not .docx?
    There is mentioning of Conversion Tools in ‘Features’: pdf, html, doc**.

    Can phpdocx output to .doc?