473,378 Members | 1,639 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,378 software developers and data experts.

pdflib help adding an image

hi,

i am trying to create a pdf using pdflib in php which includes some
text and an image. however, the part that loads the image seems to
keep failing. can someone help please?

the code:

<?php
$mypdf = PDF_new();
pdf_open_file($mypdf, "this_is_it.pdf");
pdf_begin_page($mypdf, 595, 842);
$myfont = PDF_findfont($mypdf, "Times-Roman", "host", 0);
pdf_setfont($mypdf, $myfont, 10);
pdf_show_xy($mypdf, "Sample PDF, constructed by PHP in real-time.",
50, 750);
pdf_show_xy($mypdf, "Made with the PDF libraries for PHP.", 50, 730);
$myimage = pdf_load_image($mypdf,"jpeg","test.jpg","");
pdf_fit_image($mypdf, $myimage, 390,575, ""); //place image within
page coordinates
pdf_close_image($mypdf, $myimage);
PDF_end_page($mypdf);
PDF_close($mypdf);
PDF_delete($mypdf);
?>

the error:

PHP Fatal error: Uncaught exception 'PDFlibException' with message
'Handle parameter 'image' has bad value 0' in C:\Inetpub\wwwroot\files
\hello6.php:11 Stack trace: #0 C:\Inetpub\wwwroot\files
\hello6.php(11): pdf_place_image(Resource id #1, 0, 50, 650, 0.6) #1
{main} thrown in C:\Inetpub\wwwroot\files\hello6.php on line 11

thanks in advance for your help.

Apr 30 '07 #1
1 6739
PHP Fatal error: Uncaught exception 'PDFlibException' with message
'Handle parameter 'image' has bad value 0' in C:\Inetpub\wwwroot\files
\hello6.php:11 Stack trace: #0 C:\Inetpub\wwwroot\files
\hello6.php(11): pdf_place_image(Resource id #1, 0, 50, 650, 0.6) #1
{main} thrown in C:\Inetpub\wwwroot\files\hello6.php on line 11
I think pdf_load_image() failed and returned 0. Make sure the filename
is correct, the file permissions are good, and anything else you can
think of that could go wrong on that line.

-Mike PII

Apr 30 '07 #2

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

Similar topics

2
by: Randell D. | last post by:
Folks, I've read the PHP online help file and I believe the ClibPDF functionality is seperate, but similar to the PDFlib version - What is the difference? Why would one use one, instead of the...
2
by: bonehead | last post by:
Greetings, Apologies in advance for the crosspost. I would like to determine if the PDFlib library has been installed on a shared server which I do not administer. Is there a command I can run...
0
by: ian douglas | last post by:
Hey all, Anyone have a wraper written as a drop-in replacement for PDFlib? That is, use their function names, parameters, pretty much identically? I'm making some slight modifications to an...
0
by: acorn71 | last post by:
Hello, Are there advantages to using PDFlib over FPDF? My employer has purchased a license to PDFlib but I wanted to know if FPDF is a better overall choice. I'm specifically referring to any...
0
by: Rul | last post by:
i have to build pdf files from tiff in a visual basic application, so i downloaded http://download.devparadise.com/pdflib-2.01.zip pdflib's 2.01 source to make the visual basic bind, but the vb...
0
by: Jeff_M | last post by:
I asked my web hosting company to install PDFlib so that I could create, just very simple dynamic pdfs. (using PHP5) They said it is installed. When I call phpinfo(), I see this . Configure...
2
by: Nader Emami | last post by:
L.S., Would somebody help me about PDFlib using? I am a user of a Linux machine (not root) and I have installed PDFlib somewhere in my home directory. So I can't change the '/etc/php.ini' file....
0
by: seth.northrop | last post by:
Hi, I get this error with the new PHP PDF Binaries: http://pecl.php.net/bugs/bug.php?id=9491&edit=1 And I've attempted to do the workaround (install a newer PDFLib binary). That fixes the...
1
by: sanjeev1984chadha | last post by:
Hi I am facing trouble in calling PDFlib class i have a file called "export.php"and while running it from command prompt i get an error Fatal error: Class 'PDFlib' not found in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.