You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Al Dancer <re...@yahoo.com> on 2008/11/25 13:41:53 UTC

FOP to PDF using PHP

Hello,

I've installed PHP-Java-Bridge 5.2.2
and would like to create a PDF file using FOP and PHP.
OS: Solaris 10
FOP: version 0.95
PHP: version 5.2.6
Java: jdk1.6.0
Apache: Server Version: Apache/2.2.9

when I run fop from the command line, the PDF file was created.
./fop test.fo test.pdf

But when I created a PHP file, let's say mytest.php as following:
---------------------------
<?php
require_once ("XML/fo2pdf.php");
$pdf = new XML_fo2pdf( );
$pdf->tmpdir = "/tmp";
$pdf->run("/tmp/simple.fo", "/tmp/simple.pdf");
$pdf->printPDF();
$pdf->deletePDF();
?>
---------------------------

I could not see any PDF file in my browser after checking the PHP page
http://my-server/mytest.php

The script exited after executing $pdf->run("/tmp/simple.fo", "/tmp/simple.pdf");
without any errors or warning (I've checked the apache log file, php-java-bridge.log file,phperror logfile)

I have tried the runFromFile and runFromString (in fo2pdf.php) methods they behave the same way.

My question is : is FOP 0.95 working with PHP-Java-Bridge 5.2.2 and PHP 5.2.6, Java_1.6.0 ?
Any help would be appreciated.

BTW, the same script (PHP) is working with:
FOP: 0.20.4, PHP-Java-Bridge-4.0.8a, Java jdk1.5.0_06 (I mean the PDF file has been created).

Al




      

Re: FOP & ApplicationServer Environment (Multithread)

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
My multi-threading test harness starts a configurable number of parallel
FOP instances but I've never come across an exception there. Anyway, I
suggest you look at the following FAQ entry, because the exception below
is just a follow-up error. The original error has likely been swallowed
by Xalan's default ErrorListener.

http://xmlgraphics.apache.org/fop/faq.html#saxexception-mismatch

Maybe that helps finding the original problem. From there we should be
able to go forward.

On 26.11.2008 15:21:59 Tobias van Treeck wrote:
> Hi,
> 
> we use FOP 0.95 in an application server environment. Recently we did
> some loadtests and
> everything is fine so far, except for one small issue:
> 
> Tests:
> - 5 parallel users
> - bea application server
> 
> We get an exception in the very first run in the initialization phase of
> FOP. When the
> first user starts to generate a pdf and the others try to generate also
> (shortly behind)
> - then we get the exception given below. After that the loadtest is
> fine.
> The problem seems to be that when the first user initializes FOP and
> during that
> time other threads try to access it - it fails. 
> If we make the test with just one user or one user and 4 others which
> start later then
> everything is fine.
> 
> Any ideas?
> Help appreciated,
> ToM
> 
> 
> org.xml.sax.SAXException: Mismatch: page-sequence
> (http://www.w3.org/1999/XSL/Format) vs. root
> (http://www.w3.org/1999/XSL/Format) [Fehler 88147]
> [de.something.OurExampleGeneratorImpl]
> javax.xml.transform.TransformerException: org.xml.sax.SAXException:
> Mismatch: page-sequence (http://www.w3.org/1999/XSL/Format) vs. root
> (http://www.w3.org/1999/XSL/Format)
>         at
> org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:725)
>         at
> org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:425)
>         at
> org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:216)
>         at
> org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
>         at
> org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2160)
>         at
> org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1213)
>         at
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668)
>         at
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
>         at
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
>  
> 
>       at
> weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:492)
>         at
> weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
>         at
> weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:435)
>         at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
>         at
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
>         at
> weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:430)
>         at
> weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:35)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
> Caused by: org.xml.sax.SAXException: Mismatch: page-sequence
> (http://www.w3.org/1999/XSL/Format) vs. root
> (http://www.w3.org/1999/XSL/Format)
>         at
> org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:335)
>         at
> org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:169)
>         at
> org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.java:309)
>         at
> org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:716)
>         ... 26 more
> 
> >We're just being cautious as we don't currently have the necessary
> >infrastructure to continuously test multi-threading behaviour. Many
> >people
> >are using FOP in a multi-threading environment and FOP seems to behave
> >well. Just go ahead and use it, but do some load tests. I know of no
> >current issues with multi-threading in 0.94 or current FOP Trunk.
> 
> >On 19.02.2008 11:06:19 Laurent Berthelot wrote:
> >> Hello,
> >> 
> >> I want to use Fop in a multi-thread environement (J2EE) and on the
> >> Apache
> >> site it signals that Apache FOP may currently not be completely
> >> thread safe.
> >> 
> >> Have you yet experimented that ?
> >> And if yes, had you problems with ?
> >Jeremias Maerki
> 
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


FOP & ApplicationServer Environment (Multithread)

Posted by Tobias van Treeck <tv...@nepatec.de>.
Hi,

we use FOP 0.95 in an application server environment. Recently we did
some loadtests and
everything is fine so far, except for one small issue:

Tests:
- 5 parallel users
- bea application server

We get an exception in the very first run in the initialization phase of
FOP. When the
first user starts to generate a pdf and the others try to generate also
(shortly behind)
- then we get the exception given below. After that the loadtest is
fine.
The problem seems to be that when the first user initializes FOP and
during that
time other threads try to access it - it fails. 
If we make the test with just one user or one user and 4 others which
start later then
everything is fine.

Any ideas?
Help appreciated,
ToM


org.xml.sax.SAXException: Mismatch: page-sequence
(http://www.w3.org/1999/XSL/Format) vs. root
(http://www.w3.org/1999/XSL/Format) [Fehler 88147]
[de.something.OurExampleGeneratorImpl]
javax.xml.transform.TransformerException: org.xml.sax.SAXException:
Mismatch: page-sequence (http://www.w3.org/1999/XSL/Format) vs. root
(http://www.w3.org/1999/XSL/Format)
        at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:725)
        at
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:425)
        at
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:216)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
        at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2160)
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1213)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
 

      at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:492)
        at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
        at
weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:435)
        at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
        at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
        at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:430)
        at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:35)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
Caused by: org.xml.sax.SAXException: Mismatch: page-sequence
(http://www.w3.org/1999/XSL/Format) vs. root
(http://www.w3.org/1999/XSL/Format)
        at
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:335)
        at
org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:169)
        at
org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.java:309)
        at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:716)
        ... 26 more

>We're just being cautious as we don't currently have the necessary
>infrastructure to continuously test multi-threading behaviour. Many
>people
>are using FOP in a multi-threading environment and FOP seems to behave
>well. Just go ahead and use it, but do some load tests. I know of no
>current issues with multi-threading in 0.94 or current FOP Trunk.

>On 19.02.2008 11:06:19 Laurent Berthelot wrote:
>> Hello,
>> 
>> I want to use Fop in a multi-thread environement (J2EE) and on the
>> Apache
>> site it signals that Apache FOP may currently not be completely
>> thread safe.
>> 
>> Have you yet experimented that ?
>> And if yes, had you problems with ?
>Jeremias Maerki




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP to PDF using PHP

Posted by Al Dancer <re...@yahoo.com>.
Hi Andreas,

I've already thought and read about the FOP embedding this morning, but have not decided
to use it.
Thank you for the URL and for your help, I will use the FOP2PDF.java instead of the PEAR XML_fop2pdf.php.

rgds,

Al

--- On Tue, 11/25/08, Andreas Delmelle <an...@telenet.be> wrote:
From: Andreas Delmelle <an...@telenet.be>
Subject: Re: FOP to PDF using PHP
To: fop-users@xmlgraphics.apache.org
Date: Tuesday, November 25, 2008, 10:00 AM

On Nov 25, 2008, at 18:32, Andreas Delmelle wrote:

> On Nov 25, 2008, at 16:46, Al Dancer wrote:
> 
> Hi
> 
>> it seems that this is a Java issue:
>> 
>> here below is the extract of the fo2pdf.php code where my script
exited:
>> <snip />
>> So the script could not run :
>> $options = @new
Java("org.apache.fop.apps.CommandLineOptions", $options)
>> 
>> This may be should to the java mailing list :-(
> 

Sorry for the noise. I just noticed...

org.apache.fop.apps.CommandLineOptions does not exist anymore in later versions
of FOP.
It has been relocated to org.apache.fop.cli.CommandLineOptions.

To make up for the irrelevant comment, I'll add a pointer to the Wiki about
using the PHP/Java bridge (which I didn't see in the thread yet):
http://wiki.apache.org/xmlgraphics-fop/HowTo/PHPJavaBridge

This is still for v0.20.5, but I think, if you study the FOP embedding
examples[*] closely, the cost for converting it to work for 0.95 would be
minimal.

[*]
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleFO2PDF.java?view=markup
   
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleXML2PDF.java?view=markup

Downside is that it would add another dependency to your web-app, which may
only prove to be really worth something if you also use other Java components.

HTH!

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org




      

Re: FOP to PDF using PHP

Posted by Andreas Delmelle <an...@telenet.be>.
On Nov 25, 2008, at 18:32, Andreas Delmelle wrote:

> On Nov 25, 2008, at 16:46, Al Dancer wrote:
>
> Hi
>
>> it seems that this is a Java issue:
>>
>> here below is the extract of the fo2pdf.php code where my script  
>> exited:
>> <snip />
>> So the script could not run :
>> $options = @new Java("org.apache.fop.apps.CommandLineOptions",  
>> $options)
>>
>> This may be should to the java mailing list :-(
>

Sorry for the noise. I just noticed...

org.apache.fop.apps.CommandLineOptions does not exist anymore in  
later versions of FOP.
It has been relocated to org.apache.fop.cli.CommandLineOptions.

To make up for the irrelevant comment, I'll add a pointer to the Wiki  
about using the PHP/Java bridge (which I didn't see in the thread yet):
http://wiki.apache.org/xmlgraphics-fop/HowTo/PHPJavaBridge

This is still for v0.20.5, but I think, if you study the FOP  
embedding examples[*] closely, the cost for converting it to work for  
0.95 would be minimal.

[*] http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/ 
embedding/java/embedding/ExampleFO2PDF.java?view=markup
     http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/ 
embedding/java/embedding/ExampleXML2PDF.java?view=markup

Downside is that it would add another dependency to your web-app,  
which may only prove to be really worth something if you also use  
other Java components.

HTH!

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP to PDF using PHP

Posted by Andreas Delmelle <an...@telenet.be>.
On Nov 25, 2008, at 16:46, Al Dancer wrote:

Hi

> it seems that this is a Java issue:
>
> here below is the extract of the fo2pdf.php code where my script  
> exited:
> <snip />
> So the script could not run :
> $options = @new Java("org.apache.fop.apps.CommandLineOptions",  
> $options)
>
> This may be should to the java mailing list :-(

Just to be sure: if you encounter no problems when running FOP  
standalone on the same machine, check if the user-account that  
effectively executes the script, has access to the home-dir of the  
Java VM. Typically, if the people in charge of configuration of the  
web-server have done their job properly, the access of such accounts  
is severely restricted, so perhaps it cannot find a JVM at run-time (?)


HTH!

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP to PDF using PHP

Posted by Al Dancer <re...@yahoo.com>.
Hello all,

I give up, since the last version of XML_fo2pdf 5 years old (2003), and is working for FOP 0.2x but not for FOP 0.95.

http://pear.php.net/package/XML_fo2pdf/download

Therefore, I will use the FOP 0.2 with older Java (version jdk1.5.0).

thanks,

Al


--- On Tue, 11/25/08, Al Dancer <re...@yahoo.com> wrote:
From: Al Dancer <re...@yahoo.com>
Subject: Re: FOP to PDF using PHP
To: fop-users@xmlgraphics.apache.org
Date: Tuesday, November 25, 2008, 8:06 AM

Hello Luis,

thank you, I will try what you said about the object's creation.

Al

--- On Tue, 11/25/08, Luis Ferro <ki...@gmail.com> wrote:
From: Luis Ferro <ki...@gmail.com>
Subject: Re: FOP to PDF using PHP
To: fop-users@xmlgraphics.apache.org
Date: Tuesday, November 25, 2008, 7:59 AM

There was a sample somewhere (can't find it at the moment) with an example on how to create a pdf with fop in java.

Using the bridge you will be able to "transpose" the sample to php and retain the ability to debug everything in php. That was what i did.


Doing a line by line transposing you will start to get some "factory" creation errors, but you will get over it with the correct object creation and initialization.

Also, remember to create ALL the objects, don't do any "instant" creation line:


$xpto = $java->factory_bla( $java->newObject() );

Because the reference to the $java->newObject() will stay to nail you down...

Do:

$new = $java->newObject();
$xpto = $java->factory_bla( $new );



Not sure if this is of help... but alas...

;)




      


      

Re: FOP to PDF using PHP

Posted by Al Dancer <re...@yahoo.com>.
Hello Luis,

thank you, I will try what you said about the object's creation.

Al

--- On Tue, 11/25/08, Luis Ferro <ki...@gmail.com> wrote:
From: Luis Ferro <ki...@gmail.com>
Subject: Re: FOP to PDF using PHP
To: fop-users@xmlgraphics.apache.org
Date: Tuesday, November 25, 2008, 7:59 AM

There was a sample somewhere (can't find it at the moment) with an example on how to create a pdf with fop in java.

Using the bridge you will be able to "transpose" the sample to php and retain the ability to debug everything in php. That was what i did.


Doing a line by line transposing you will start to get some "factory" creation errors, but you will get over it with the correct object creation and initialization.

Also, remember to create ALL the objects, don't do any "instant" creation line:


$xpto = $java->factory_bla( $java->newObject() );

Because the reference to the $java->newObject() will stay to nail you down...

Do:

$new = $java->newObject();
$xpto = $java->factory_bla( $new );



Not sure if this is of help... but alas...

;)




      

Re: FOP to PDF using PHP

Posted by Luis Ferro <ki...@gmail.com>.
There was a sample somewhere (can't find it at the moment) with an example
on how to create a pdf with fop in java.

Using the bridge you will be able to "transpose" the sample to php and
retain the ability to debug everything in php. That was what i did.

Doing a line by line transposing you will start to get some "factory"
creation errors, but you will get over it with the correct object creation
and initialization.

Also, remember to create ALL the objects, don't do any "instant" creation
line:

$xpto = $java->factory_bla( $java->newObject() );

Because the reference to the $java->newObject() will stay to nail you
down...

Do:

$new = $java->newObject();
$xpto = $java->factory_bla( $new );

Not sure if this is of help... but alas...

;)

AW: FOP to PDF using PHP

Posted by Georg Datterl <ge...@geneon.de>.
Hi Al, 

Well, as a java user with no PHP experience I'd have to say, I can't see why you think it's a java problem. So probably the java list couldn't help you much either...

Regards,
 
Georg Datterl
 
------ Kontakt ------
 
Georg Datterl
 
Geneon media solutions gmbh
Gutenstetter Straße 8a
90449 Nürnberg
 
HRB Nürnberg: 17193
Geschäftsführer: Yong-Harry Steiert 

Tel.: 0911/36 78 88 - 26
Fax: 0911/36 78 88 - 20
 
www.geneon.de
 
Weitere Mitglieder der Willmy MediaGroup:
 
IRS Integrated Realization Services GmbH:    www.irs-nbg.de 
Willmy PrintMedia GmbH:                            www.willmy.de
Willmy Consult & Content GmbH:                 www.willmycc.de 
-----Ursprüngliche Nachricht-----
Von: Al Dancer [mailto:reggaepercus@yahoo.com] 
Gesendet: Dienstag, 25. November 2008 16:47
An: fop-users@xmlgraphics.apache.org
Betreff: Re: FOP to PDF using PHP

Hi again,

it seems that this is a Java issue:

here below is the extract of the fo2pdf.php code where my script exited:

*************************************************************************************
 function run($fo, $pdf = '', $DelFo = false)
    {
        $returnuri = false;
        if (!$pdf) {
            $pdf = tempnam($this->tmpdir, $this->tmppdfprefix);
            $returnuri = true;
        }
        $this->pdf = $pdf;
        $this->fo  = $fo;
        $options   = array();

        if ($this->configFile) {
            $options = array('-c', $this->configFile);
        }
        array_push($options, $this->fo, '-' . $this->renderer, $this->pdf);

        if (!$options = @new Java("org.apache.fop.apps.CommandLineOptions", $options)) {
          return PEAR::raiseError('Unable to create Java Virtual Machine in ' . __FILE__ . ':' . __LINE__, 11, PEAR_ERROR_RETURN, null, null);
        } // if
*************************************************************************************

So the script could not run : 
$options = @new Java("org.apache.fop.apps.CommandLineOptions", $options)

This may be should to the java mailing list :-(

thanks,

Al

--- On Tue, 11/25/08, Al Dancer <re...@yahoo.com> wrote:


	From: Al Dancer <re...@yahoo.com>
	Subject: Re: FOP to PDF using PHP
	To: fop-users@xmlgraphics.apache.org
	Date: Tuesday, November 25, 2008, 7:33 AM
	
	
Hello,

I've tried to change the Apache PATH environment, and this didn't help.

>From the php script I tried to create a file to the /tmp directory as:

$fp = fopen('/tmp/simple.txt', 'w+');
fwrite($fp, 'Try text file');
fclose($fp);

The file has been created, hence there no permission denied to /tmp

fo2pdf.php FO to pdf converter from PEAR
(info: http://pear.php.net/package/XML_fo2pdf/docs/latest/XML/XML_fo2pdf.html)

and the fop Home directory is : /opt/coolstack/fop ls -al /opt/coolstack/fop
drwxrwxrwx   9 webservd webservd     512 Nov 25 12:20 fop/

best regards,

Al

--- On Tue, 11/25/08, Luis Ferro <ki...@gmail.com> wrote:


	From: Luis Ferro <ki...@gmail.com>
	Subject: Re: FOP to PDF using PHP
	To: fop-users@xmlgraphics.apache.org, reggaepercus@yahoo.com
	Date: Tuesday, November 25, 2008, 7:11 AM
	
	
	I've no idea what you are trying to do...
	
	What is behind the "XML/fo2pdf.php" file?
	
	I'd used the javabridge (an older version true) with FOP (also an older version 0.94 if i recall correctly), and i had it setup to work with tomcat as application server. I found it needed so that i could increase the memory for the processing threads...
	
	If on that file there are error trappings, disable them so that you get the full errors (or do some error trapping of what is going on), because something will be amiss.
	
	Also double check the paths, because you can't be sure where the path is really inside the several layers.
	
	[you can be trying to produce the pdf, but inside fop, the path of the file can, be for instance, pointing to the directory where fop is installed.
	
	Keep us posted...
	
	;)
	
	
	On Tue, Nov 25, 2008 at 2:22 PM, Al Dancer <re...@yahoo.com> wrote:
	

Hello,

thank you for your answer.

Everyone has full access to the directory /tmp (read, write, execute for all) ls -al /tmp
drwxrwxrwt   7 root     sys         3388 Nov 25 14:42 tmp/

I have set PATH to /usr/local/bin:/usr/sbin:/usr/bin in Apache environment. I'll try to add there /opt/coolstack/apache2/bin:/usr/php5/bin etc...
and will see.

Al

--- On Tue, 11/25/08, Jean-François El Fouly <je...@elfouly.fr> wrote:


	From: Jean-François El Fouly <je...@elfouly.fr>
	Subject: Re: FOP to PDF using PHP
	To: fop-users@xmlgraphics.apache.org
	Date: Tuesday, November 25, 2008, 5:51 AM


	paul womack
	 a écrit :
	>
	> Permissions, file paths, or $PATH errors would be the usual
	> suspects.
	>
	>   BugBear
	In particular, I remember that we had to change permissions to write in 
	the user's home directory, and IIRC this is related to font caching.
	
	
	---------------------------------------------------------------------
	To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
	
	For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
	






---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP to PDF using PHP

Posted by Al Dancer <re...@yahoo.com>.
Hi again,

it seems that this is a Java issue:

here below is the extract of the fo2pdf.php code where my script exited:

*************************************************************************************
 function run($fo, $pdf = '', $DelFo = false)
    {
        $returnuri = false;
        if (!$pdf) {
            $pdf = tempnam($this->tmpdir, $this->tmppdfprefix);
            $returnuri = true;
        }
        $this->pdf = $pdf;
        $this->fo  = $fo;
        $options   = array();

        if ($this->configFile) {
            $options = array('-c', $this->configFile);
        }
        array_push($options, $this->fo, '-' . $this->renderer, $this->pdf);

        if (!$options = @new Java("org.apache.fop.apps.CommandLineOptions", $options)) {
          return PEAR::raiseError('Unable to create Java Virtual Machine in ' . __FILE__ . ':' . __LINE__, 11, PEAR_ERROR_RETURN, null, null);
        } // if
*************************************************************************************

So the script could not run : 
$options = @new Java("org.apache.fop.apps.CommandLineOptions", $options)

This may be should to the java mailing list :-(

thanks,

Al

--- On Tue, 11/25/08, Al Dancer <re...@yahoo.com> wrote:
From: Al Dancer <re...@yahoo.com>
Subject: Re: FOP to PDF using PHP
To: fop-users@xmlgraphics.apache.org
Date: Tuesday, November 25, 2008, 7:33 AM

Hello,

I've tried to change the Apache PATH environment, and this didn't help.

>From the php script I tried to create a file to the /tmp directory as:

$fp = fopen('/tmp/simple.txt', 'w+');
fwrite($fp, 'Try text file');
fclose($fp);

The file has been created, hence there no permission denied to /tmp

fo2pdf.php FO to pdf converter from PEAR 
(info: http://pear.php.net/package/XML_fo2pdf/docs/latest/XML/XML_fo2pdf.html)

and the fop Home directory is : /opt/coolstack/fop
ls -al /opt/coolstack/fop
drwxrwxrwx   9 webservd webservd     512 Nov 25 12:20 fop/

best regards,

Al

--- On Tue, 11/25/08, Luis Ferro <ki...@gmail.com> wrote:
From: Luis
 Ferro <ki...@gmail.com>
Subject: Re: FOP to PDF using PHP
To: fop-users@xmlgraphics.apache.org, reggaepercus@yahoo.com
Date: Tuesday, November 25, 2008, 7:11 AM

I've no idea what you are trying to do...

What is behind the "XML/fo2pdf.php" file?

I'd used the javabridge (an older version true) with FOP (also an older version 0.94 if i recall correctly), and i had it setup to work with tomcat as application server. I found it needed so that i could increase the memory for the processing threads...


If on that file there are error trappings, disable them so that you get the full errors (or do some error trapping of what is going on), because something will be amiss.

Also double check the paths, because you can't be sure where the path is really inside the several layers.


[you can be trying to produce the pdf, but inside fop, the path of the file can, be for instance, pointing to the directory where fop is installed.

Keep us posted...

;)

On Tue, Nov 25, 2008 at 2:22 PM, Al Dancer <re...@yahoo.com> wrote:


Hello,

thank you for your answer.

Everyone has full access to the directory /tmp (read, write, execute for all)
ls -al /tmp
drwxrwxrwt   7 root     sys         3388 Nov 25 14:42 tmp/

I have set PATH to /usr/local/bin:/usr/sbin:/usr/bin 

in Apache environment. I'll try to add there /opt/coolstack/apache2/bin:/usr/php5/bin etc...
and will see.

Al

--- On Tue, 11/25/08, Jean-François El Fouly <je...@elfouly.fr> wrote:

From: Jean-François El Fouly <je...@elfouly.fr>

Subject: Re: FOP to PDF using PHP
To: fop-users@xmlgraphics.apache.org
Date: Tuesday, November 25, 2008, 5:51 AM


paul womack
 a écrit :
>
> Permissions, file paths, or $PATH errors would be the usual
> suspects.
>
>   BugBear
In particular, I remember that we had to change permissions to write in 
the user's home directory, and IIRC this is related to font caching.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org

For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org




      




      


      

Re: FOP to PDF using PHP

Posted by Al Dancer <re...@yahoo.com>.
Hello,

I've tried to change the Apache PATH environment, and this didn't help.

>From the php script I tried to create a file to the /tmp directory as:

$fp = fopen('/tmp/simple.txt', 'w+');
fwrite($fp, 'Try text file');
fclose($fp);

The file has been created, hence there no permission denied to /tmp

fo2pdf.php FO to pdf converter from PEAR 
(info: http://pear.php.net/package/XML_fo2pdf/docs/latest/XML/XML_fo2pdf.html)

and the fop Home directory is : /opt/coolstack/fop
ls -al /opt/coolstack/fop
drwxrwxrwx   9 webservd webservd     512 Nov 25 12:20 fop/

best regards,

Al

--- On Tue, 11/25/08, Luis Ferro <ki...@gmail.com> wrote:
From: Luis Ferro <ki...@gmail.com>
Subject: Re: FOP to PDF using PHP
To: fop-users@xmlgraphics.apache.org, reggaepercus@yahoo.com
Date: Tuesday, November 25, 2008, 7:11 AM

I've no idea what you are trying to do...

What is behind the "XML/fo2pdf.php" file?

I'd used the javabridge (an older version true) with FOP (also an older version 0.94 if i recall correctly), and i had it setup to work with tomcat as application server. I found it needed so that i could increase the memory for the processing threads...


If on that file there are error trappings, disable them so that you get the full errors (or do some error trapping of what is going on), because something will be amiss.

Also double check the paths, because you can't be sure where the path is really inside the several layers.


[you can be trying to produce the pdf, but inside fop, the path of the file can, be for instance, pointing to the directory where fop is installed.

Keep us posted...

;)

On Tue, Nov 25, 2008 at 2:22 PM, Al Dancer <re...@yahoo.com> wrote:


Hello,

thank you for your answer.

Everyone has full access to the directory /tmp (read, write, execute for all)
ls -al /tmp
drwxrwxrwt   7 root     sys         3388 Nov 25 14:42 tmp/

I have set PATH to /usr/local/bin:/usr/sbin:/usr/bin 

in Apache environment. I'll try to add there /opt/coolstack/apache2/bin:/usr/php5/bin etc...
and will see.

Al

--- On Tue, 11/25/08, Jean-François El Fouly <je...@elfouly.fr> wrote:

From: Jean-François El Fouly <je...@elfouly.fr>

Subject: Re: FOP to PDF using PHP
To: fop-users@xmlgraphics.apache.org
Date: Tuesday, November 25, 2008, 5:51 AM


paul womack
 a écrit :
>
> Permissions, file paths, or $PATH errors would be the usual
> suspects.
>
>   BugBear
In particular, I remember that we had to change permissions to write in 
the user's home directory, and IIRC this is related to font caching.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org

For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org




      




      

Re: FOP to PDF using PHP

Posted by Luis Ferro <ki...@gmail.com>.
I've no idea what you are trying to do...

What is behind the "XML/fo2pdf.php" file?

I'd used the javabridge (an older version true) with FOP (also an older
version 0.94 if i recall correctly), and i had it setup to work with tomcat
as application server. I found it needed so that i could increase the memory
for the processing threads...

If on that file there are error trappings, disable them so that you get the
full errors (or do some error trapping of what is going on), because
something will be amiss.

Also double check the paths, because you can't be sure where the path is
really inside the several layers.

[you can be trying to produce the pdf, but inside fop, the path of the file
can, be for instance, pointing to the directory where fop is installed.

Keep us posted...

;)

On Tue, Nov 25, 2008 at 2:22 PM, Al Dancer <re...@yahoo.com> wrote:

> Hello,
>
> thank you for your answer.
>
> Everyone has full access to the directory /tmp (read, write, execute for
> all)
> ls -al /tmp
> drwxrwxrwt   7 root     sys         3388 Nov 25 14:42 tmp/
>
> I have set PATH to /usr/local/bin:/usr/sbin:/usr/bin
> in Apache environment. I'll try to add there
> /opt/coolstack/apache2/bin:/usr/php5/bin etc...
> and will see.
>
> Al
>
> --- On *Tue, 11/25/08, Jean-François El Fouly <je...@elfouly.fr>*wrote:
>
> From: Jean-François El Fouly <je...@elfouly.fr>
> Subject: Re: FOP to PDF using PHP
> To: fop-users@xmlgraphics.apache.org
> Date: Tuesday, November 25, 2008, 5:51 AM
>
>
> paul womack
>  a écrit :
> >
> > Permissions, file paths, or $PATH errors would be the usual
> > suspects.
> >
> >   BugBear
> In particular, I remember that we had to change permissions to write in
> the user's home directory, and IIRC this is related to font caching.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
>

Re: FOP to PDF using PHP

Posted by Al Dancer <re...@yahoo.com>.
Hello,

thank you for your answer.

Everyone has full access to the directory /tmp (read, write, execute for all)
ls -al /tmp
drwxrwxrwt   7 root     sys         3388 Nov 25 14:42 tmp/

I have set PATH to /usr/local/bin:/usr/sbin:/usr/bin 
in Apache environment. I'll try to add there /opt/coolstack/apache2/bin:/usr/php5/bin etc...
and will see.

Al

--- On Tue, 11/25/08, Jean-François El Fouly <je...@elfouly.fr> wrote:
From: Jean-François El Fouly <je...@elfouly.fr>
Subject: Re: FOP to PDF using PHP
To: fop-users@xmlgraphics.apache.org
Date: Tuesday, November 25, 2008, 5:51 AM

paul womack a écrit :
>
> Permissions, file paths, or $PATH errors would be the usual
> suspects.
>
>   BugBear
In particular, I remember that we had to change permissions to write in 
the user's home directory, and IIRC this is related to font caching.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org




      

Re: FOP to PDF using PHP

Posted by Jean-François El Fouly <je...@elfouly.fr>.
paul womack a écrit :
>
> Permissions, file paths, or $PATH errors would be the usual
> suspects.
>
>   BugBear
In particular, I remember that we had to change permissions to write in 
the user's home directory, and IIRC this is related to font caching.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: FOP to PDF using PHP

Posted by paul womack <pw...@papermule.co.uk>.
Al Dancer wrote:
> Hello,
> 
> I've installed PHP-Java-Bridge 5.2.2
> and would like to create a PDF file using FOP and PHP.
> OS: Solaris 10
> FOP: version 0.95
> PHP: version 5.2.6
> Java: jdk1.6.0
> Apache: Server Version: Apache/2.2.9
> 
> when I run fop from the command line, the PDF file was created.
> ./fop test.fo <http://test.fo> test.pdf
> 
> But when I created a PHP file, let's say mytest.php as following:
> ---------------------------
> <?php
> require_once ("XML/fo2pdf.php");
> $pdf = new XML_fo2pdf( );
> $pdf->tmpdir = "/tmp";
> $pdf->run("/tmp/simple.fo", "/tmp/simple.pdf");
> $pdf->printPDF();
> $pdf->deletePDF();
> ?>
> ---------------------------
> 
> I could not see any PDF file in my browser after checking the PHP page
> http://my-server/mytest.php
> 
> The script exited after executing $pdf->run("/tmp/simple.fo", 
> "/tmp/simple.pdf");
> without any errors or warning (I've checked the apache log file, 
> php-java-bridge.log file,phperror logfile)
> 
> I have tried the runFromFile and runFromString (in fo2pdf.php) methods 
> they behave the same way.
> 
> My question is : is FOP 0.95 working with PHP-Java-Bridge 5.2.2 and PHP 
> 5.2.6, Java_1.6.0 ?
> Any help would be appreciated.
> 
> BTW, the same script (PHP) is working with:
> FOP: 0.20.4, PHP-Java-Bridge-4.0.8a, Java jdk1.5.0_06 (I mean the PDF 
> file has been created).

Permissions, file paths, or $PATH errors would be the usual
suspects.

   BugBear

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org