1
PHPhurts
Create PDF's on the fly
  • 2005/1/14 14:21

  • PHPhurts

  • Just popping in

  • Posts: 23

  • Since: 2004/12/28


I am intrigued by the PDF features in the forum. I would love to add that ability for my business forms, populating them on the fly or from a database. I am building site using XOOPS and thinking of porting in netoffice or someother CSM/Transaction Management application. Is there a Module somewhere that might add the PDF capability?

2
carnuke
Re: Create PDF's on the fly
  • 2005/1/14 14:31

  • carnuke

  • Home away from home

  • Posts: 1955

  • Since: 2003/11/5


The documentation site uses a module called xDocman. Visit the official documents on the docs site to see this.

It presents a list of documents that can be grabbed in different formats, including PDF. It does require XML input however, so it is not (yet) completely seemless. You can see the project on the http://devs.xoops.org site Its run by robekras.

Regards.

3
jdseymour
Re: Create PDF's on the fly

Not a module, but I found a PHP program that I am looking at for perhaps possible use with my XOOPS site.

It is dompdf

I haven't had much time to read through the documentation. It is written for PHP5, but states that it should work with PHP4 versions.

Let me know what you think.

4
jensclas
Re: Create PDF's on the fly

Hi john
When you have found a solution please let me know too

5
kenmcd
Re: Create PDF's on the fly
  • 2005/3/13 7:05

  • kenmcd

  • Just popping in

  • Posts: 63

  • Since: 2004/6/8 1


I found xDocman in the CVS on SourceForge.
http://cvs.sourceforge.net/viewcvs.py/xoops/modules/xdocman/

6
Mithrandir
Re: Create PDF's on the fly

Quote:

jdseymour wrote:
Not a module, but I found a PHP program that I am looking at for perhaps possible use with my XOOPS site.

It is dompdf

I haven't had much time to read through the documentation. It is written for PHP5, but states that it should work with PHP4 versions.

Let me know what you think.

Looks very interesting. So far, we have looked at CPDF, FPDF and PDML, the latter being an HTML-like syntax for PDF files that has its limits and generally not ready for inclusion, I think.

If dompdf does what it says on the box, I am impressed and excited - especially since they practically endorse the use of Smarty or similar template engines. It would be great if it could be tried out.

Something like this, in footer.php (starting at line 43):
else {
        
// RMV-NOTIFY
        
include_once XOOPS_ROOT_PATH '/include/notification_select.php';
        if (isset(
$xoopsOption['template_main'])) {
            if (isset(
$xoopsCachedTemplateId)) {
                
$xoopsTpl->assign('xoops_contents'$xoopsTpl->fetch('db:'.$xoopsOption['template_main'], $xoopsCachedTemplateId));
            } else {
                
$xoopsTpl->assign('xoops_contents'$xoopsTpl->fetch('db:'.$xoopsOption['template_main']));
            }
        } else {
            if (isset(
$xoopsCachedTemplate)) {
                
$xoopsTpl->assign('dummy_content'ob_get_contents());
                
$xoopsTpl->assign('xoops_contents'$xoopsTpl->fetch($xoopsCachedTemplate$xoopsCachedTemplateId));
            } else {
                
$xoopsTpl->assign('xoops_contents'ob_get_contents());
            }
            
ob_end_clean();
        }
                [
color=cc0000]if (isset($_GET['pdf']) ) {
                    
$tmpfile tempnam(XOOPS_UPLOAD_PATH"dompdf_");
                    
file_put_contents($tmpfile$xoopsTpl->getTemplateVars('xoops_contents'));
                    
$url XOOPS_URL."/dompdf.php?input_file=" rawurlencode($tmpfile) . "&paper=letter&output_file=" rawurlencode("My Fancy PDF.pdf");
                    
header("Location: ".$url);
                    exit();
                }[/
color]
        if (!
headers_sent()) {
            
header('Content-Type:text/html; charset='._CHARSET);
            
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
            
//header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
            
header('Cache-Control: private, no-cache');
            
header('Pragma: no-cache');
        }
        
$xoopsTpl->xoops_setCaching(0);
        
$xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html');
    }

Provided the dompdf file is in the XOOPS root and there is a GET parameter called 'pdf' it should execute that code instead of displaying the page.

Anyone volunteering to try it out?

7
jdseymour
Re: Create PDF's on the fly

If I can figure out how to install it, I will try it on my test site.

Thanks for the code.

8
jdseymour
Re: Create PDF's on the fly

Installed dompdf to the root of my test site. Get a blank page with the following error:

Quote:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /*****/*****/public_html/test/footer.php on line 76


PHP version could be the problem?

Using php 4.3.10.

9
Mithrandir
Re: Create PDF's on the fly

No, I forgot to close the quotes from the header("location: $url); line
It should be
header("location: ".$url);

10
jdseymour
Re: Create PDF's on the fly

Ok, that fixed the blank page.

But how do I use it. I see no options to make a pdf.

Note: nevermind.....when in doubt, read the directions fully.lol.

Login

Who's Online

311 user(s) are online (240 user(s) are browsing Support Forums)


Members: 0


Guests: 311


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits