PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Dell PowerEdge Servers
  #1  
Old October 16th, 2007, 02:46 AM
Martine Martine is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 3 Martine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 19 sec
Reputation Power: 0
Problem with File_PDF

Hello,

I'm using the "File_PDF" and everything works fine. There are problems when I'm having to many characters for 1 line. Everything is stored in a table, and after saving the pdf will be created.

Example code: $pdf->text(10, 45, "data");
This will show, at line 45 position 10 the word data.
This works fine. But suppose "data" would be a text block of over 150 characters. Then I should be able to put a <br> or a \n at some (logical) place.

How can I do this?
Ok, I can write some code but then I have for example d as the last word on line 1 and line 2 starts with ata.
In this case, the word data should must appear completely on the second line.

Martine

Reply With Quote
  #2  
Old October 16th, 2007, 03:10 AM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 146 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 39 m 31 sec
Reputation Power: 2
You could e.g. use multiCell() for automatic line breaks or write() which accepts the usage of "\n" in the given text.

http://pear.php.net/package/File_PDF/docs/latest/apidoc/File_PDF/File_PDF.html#methodmultiCell
http://pear.php.net/package/File_PDF/docs/latest/apidoc/File_PDF/File_PDF.html#methodwrite

Reply With Quote
  #3  
Old October 16th, 2007, 03:50 PM
Martine Martine is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 3 Martine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 19 sec
Reputation Power: 0
Thanks for helping.

I'll use function MultiCell, but do you also have an example of this?

I really don't know how to implement it in my code.
How can I say on which line, which position, ...

Grtz, Martine

Reply With Quote
  #4  
Old October 16th, 2007, 04:38 PM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 146 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 39 m 31 sec
Reputation Power: 2
You have to call setXY() before multiCell() if you're not yet at the right position:
http://pear.php.net/package/File_PDF/docs/latest/apidoc/File_PDF/File_PDF.html#methodsetXY

Reply With Quote
  #5  
Old October 17th, 2007, 08:26 AM
Martine Martine is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 3 Martine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 19 sec
Reputation Power: 0
Everything's working fine now!
Thanks a lot!

Reply With Quote
  #6  
Old December 18th, 2007, 10:11 AM
hanji hanji is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 3 hanji User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 18 sec
Reputation Power: 0
Hello

I'm having some problem with File_PDF as well.. and with line breaks. I've use both the write() and multiCell() methods, but either will return line breaks with the \n new line characters as stated in the documentation.

When I run the following code....

PHP Code:
 $p = &File_PDF::factory('P''mm''A4');
$p->setinfo('title''FOOOODOOOO');
$p->setinfo('subject''The Subject field :-)');
$p->setinfo('creator''Not mine');
$p->open();
$p->setMargins(5050);
$p->addPage('P');
$p->setFont('arial'''15);
$p->write(10'This is some text\n');
$p->write(10'And this is some more text\n***\n');
$p->text(1020'Hello');
$p->close();
// $p->save('foo.pdf');
$p->output('foo.pdf''true'); 


I get this output:
http://www. uno-code .com/files/snap.gif <- please remove spaces in the domain (I'm unable to post URLs at this point).

I also tried the multiCell method
PHP Code:
 $p->multiCell(300,200,'This is some text\n And\n this\n blah'); 


And the \n will always display in the PDF and no line break occurs.

I'm currently using the following version:
PEAR-File_PDF-0.3.1

Any ideas?

Thanks!
hanji

Reply With Quote
  #7  
Old December 18th, 2007, 10:42 AM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 146 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 39 m 31 sec
Reputation Power: 2
'\n' is not the same as "\n" (and you're looking for the latter one).

Reply With Quote
  #8  
Old December 18th, 2007, 10:49 AM
hanji hanji is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 3 hanji User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 18 sec
Reputation Power: 0
Quote:
Originally Posted by wiesemann
'\n' is not the same as "\n" (and you're looking for the latter one).


Ah.. thanks!

hanji

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > Problem with File_PDF


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway