473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

JpGraph and PDF

Hi,

I use JpGraph to generate some graphs and I have to include those
graphs in a pdf file, generated usign fPDF (http://www.fpdf.org/). If I
include a png file it's ok, the pdf file is generated, everithing goes
ok. If I use this code:
___
$logo=file_get_contents('splineex1.php');
//Output it (requires PHP>=4.3.2 and FPDF>=1.52)
$pdf->Image('var://logo', 0, 0, 150, 0, 'PNG');
___

....to include genereted graph i get this error:
___
CGI Error
The specified CGI application misbehaved by not returning a complete
set of HTTP headers. The headers it did return are:
___

So, I need to save generated graph into a file and then to include in
pdf using
___
$logo=file_get_contents('splineex1.png');
//Output it (requires PHP>=4.3.2 and FPDF>=1.52)
$pdf->Image('var://logo', 0, 0, 150, 0, 'PNG');
___

The problem is that I can't find how to save it.

http://www.fpdf.org/
http://www.aditus.nu/jpgraph/

I use PHP 4.....

Sep 20 '06 #1
2 11227

iulian.ilea wrote:
Hi,

I use JpGraph to generate some graphs and I have to include those
graphs in a pdf file, generated usign fPDF (http://www.fpdf.org/). If I
include a png file it's ok, the pdf file is generated, everithing goes
ok. If I use this code:
___
$logo=file_get_contents('splineex1.php');
//Output it (requires PHP>=4.3.2 and FPDF>=1.52)
$pdf->Image('var://logo', 0, 0, 150, 0, 'PNG');
___

...to include genereted graph i get this error:
___
CGI Error
The specified CGI application misbehaved by not returning a complete
set of HTTP headers. The headers it did return are:
___

So, I need to save generated graph into a file and then to include in
pdf using
___
$logo=file_get_contents('splineex1.png');
//Output it (requires PHP>=4.3.2 and FPDF>=1.52)
$pdf->Image('var://logo', 0, 0, 150, 0, 'PNG');
___

The problem is that I can't find how to save it.

http://www.fpdf.org/
http://www.aditus.nu/jpgraph/

I use PHP 4.....
I made it work using a trick, but I hope I'll find another solution. If
you have any ideaa... post it.

trick:
I use IIS. I created one virtual directory with a name... example (in
my cased). After, I renamed the php script in scriptphp.png (i changed
the extension to png) and from Virtual Directory tab in Internet
Information Server, click Configuration, add new extension - png - and
set it to be executed by php.

Now, if I use:
___
$pdf->Image("http://localhost/examples/scriptphp.png", 0, 0, 150, 0,
'PNG');
___

....it works.

I tried with curl too, but is not working. Or I can't make it work.

Sep 20 '06 #2
NC
iulian.ilea wrote:
>
I use JpGraph to generate some graphs and I have to include those
graphs in a pdf file, generated usign fPDF (http://www.fpdf.org/). If I
include a png file it's ok, the pdf file is generated, everithing goes
ok. If I use this code:
___
$logo=file_get_contents('splineex1.php');
If you do this, $logo will contain your PHP code. To get the image,
you need to do:

$logo = file_get_contents('http://localhost/path/splineex1.php');
So, I need to save generated graph into a file
You could, but you don't have to (see above). If you still want to
save the image into a file, you can do it inside splineex1.php by
specifying the target file name as a second argument to imagepng().
See imagepng() dicumentation:

http://www.php.net/imagepng

Alternatively, you could do:

$logo = file_get_contents('http://localhost/path/splineex1.php');
$fp = fopen('splineex1.png', 'w');
fwrite($fp, $logo);
fclose($fp);

Cheers,
NC

Sep 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Leigh Riley | last post by:
Hi there, I've installed PHP on a variety of machines, but I seem to be having a lot of trouble on Windows XP. I have 4.3.2 installed, and I would like to use...
0
by: Andrew Rich | last post by:
anybody done linear regression with jpgraph ?
3
by: Jeff | last post by:
Could someone walk me step by step on how to install and get JpGraph running on a Windows 2000+Apache+PHP+MySql server? -Thanks Jeff
3
by: J˙Giusł vs ::NRG::ius | last post by:
Hi all. How can I draw a table with jpgraph? I want a table as image. Thanks. G:
3
by: rahmawaktu | last post by:
Dear list, i am new to this forum and to JPGraph too. I just install jpgraph to create a graphic to my website. But i got error. Here is the complete code : First is MySQL Database : ( 2...
0
by: luckyG | last post by:
I have php (5.2.4) compiled on redhat 4.0 as followed : ./configure \ --with-oci8=$ORACLE_HOME --with-apxs=/usr/local/apache/bin/apxs \ --with-config-file-path=/usr/local/apache/conf \ ...
2
by: paeh | last post by:
what's wrong for this php code. when I run did not display anything in browser.. this is code: <?php include ("C:/Program Files/Apache Software...
2
by: AARTHISUBBU | last post by:
i m quiet new to wamp... is it possible to run jpgraph codes in wamp... else i have to install jpgraph separately and to run?.. if i can run jpgraph codes in wamp,what i have to do? i m using...
0
by: eureka2050 | last post by:
Hi all, I am creating a radar chart containing 2 plots using jpgraph. My code is as follows:- include ("./jpgraph/src/jpgraph.php"); include ("./jpgraph/src/jpgraph_radar.php"); //...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.