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

How to set the font for the PDF using PHP in windows ?

147 100+
Hi ,


I am trying to Create a PDF File in PHP :

This is the coding which i followed :
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $pdffile=pdf_new();
  3. pdf_open_file($pdffile,"F:\bharat.pdf");
  4. pdf_begin_page($pdffile,595,842);
  5. $fontdir = "C:\WINDOWS\Fonts";
  6. pdf_set_parameter($$pdffile, "FontOutline", "arialMyName=$fontdir\arial.ttf");
  7. $font1=pdf_findfont($pdffile,arialMyName,"host",0);
  8. pdf_setfont($pdffile,$font1,10);
  9. pdf_show_xy($pdffile,"Keep Trusting God",50,750);
  10. pdf_end_page($pdffile);
  11. pdf_close($pdffile);
  12. ?>

But when i am trying to run this program,i am facing an error is :

Fatal error: Uncaught exception 'PDFlibException' with message 'pdf_set_parameter() expects parameter 1 to be resource, null given' in C:\Program Files\xampp\htdocs\pdf_file.php:44 Stack trace: #0 C:\Program Files\xampp\htdocs\pdf_file.php(44): pdf_set_parameter() #1 {main} thrown in C:\Program Files\xampp\htdocs\pdf_file.php on line 44


thanks.....
Mar 12 '10 #1
1 1941
Atli
5,058 Expert 4TB
Hey.

You are using two $ chars in the first parameter for the pdf_set_parameter function on line #5. Removing one of them should fix this error.
Mar 12 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: James Moe | last post by:
Hello, I just joined this group and saw the discussion "What do you think of resizing 1em to 10px?" I am somewhat confused by what y'all think should be used as a reference size. I was surprised...
4
by: Eric Eggermann | last post by:
Hello all, I'm building an app that lays out and prints flash cards. Now the card might be any size, but when the user is working on the card, I draw the preview isotropically, as large as...
0
by: Martin Streller | last post by:
Hello, The code below represents a simple ownerdrawn, Listview class in C#. Its purpose is to avoid the flicker of the MS ListView. So I can't fall back to their one. Does anybody know why I...
2
by: Stuart Norris | last post by:
Dear Group, I am new to c# and windows form designer - coming from a Motif background. I am attempting to develop an application for a touch screen and I need to have a menu system with a...
0
by: Chenghui Li | last post by:
We have a problem with the Windows XP theme: We have a IDE which allows other developers to develop visual programs for their customers. Our IDE allow them to set font for window captions easyly...
7
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and...
6
by: BobAchgill | last post by:
Has anyone had success with writing text using a private font that was not already installed to the system? When I try the example code in NET Framework Developer's Guide called “Creating a...
24
by: Tony Girgenti | last post by:
Hello. Developing a Windows Form program in VS.NET VB, .NET Framework 1.1.4322 on a windows XP Pro, SP2. Before printing a document, i want to set the font to a font that is only available...
6
by: Smokey Grindle | last post by:
So back in the vista beta we were told start using Segoe UI as our GUI font... well what happens when we backport the app to XP? I don't want to change the font just for a different windows...
1
by: CMiner | last post by:
What I am trying to do is this: Let a user browse for font files that are not installed, select one, and show a sample of the font in a text box (That way the user can change the size, style, and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.