Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

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 Dev Shed Forums Sponsor:
  #1  
Old February 21st, 2013, 08:53 PM
tech0925 tech0925 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2011
Posts: 306 tech0925 User rank is Corporal (100 - 500 Reputation Level)tech0925 User rank is Corporal (100 - 500 Reputation Level)tech0925 User rank is Corporal (100 - 500 Reputation Level)tech0925 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 18 h 23 m 55 sec
Reputation Power: 5
PDF Line Breaks??

So far I have this code:

Code:
    $_tempY = $this->y;
    $this->y += 10;
    
    $commentsCollection = $invoice->getCommentsCollection(true);
    
    $internalcomments = "Internal Invoice Comments";    
    $page->drawText($internalcomments, 35, $this->y, 'UTF-8'); 
    
                foreach($commentsCollection as $comm)
                {
                    $page->drawText($comm->getData('comment'), 235, $this->y, 'UTF-8');
                    $this->y -= 10;
    
                } 


This code outputs invoice comments into the PDF. However, the comments stretch all the way to the right out of view. I have no idea how to actually put a line break in this. Also, I would like to contain this in a table if possible.

Any help would be greatly appreciated!

Reply With Quote
  #2  
Old February 22nd, 2013, 12:52 AM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,839 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 19 h 1 m 4 sec
Reputation Power: 1774
> $page->drawText($comm->getData('comment'), 235, $this->y, 'UTF-8');
So what does drawText do?
Or more specifically, what API are you using, and is there something like drawWrappedText which might offer you the ability to do some formatting.

If there is no higher level function, you might have to first do
$t = $comm->getData('comment');

Then
- get the length of the text,
- chop $t into segments of up to 80 characters (however many fit on a line)
- then draw your list of segments in your loop.

> foreach($commentsCollection as $comm)
Are there limits on the length of each comment and the number of comments?
Would you need to consider spilling a lot of comment onto multiple PDF pages?
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > PDF Line Breaks??

Developer Shed Advertisers and Affiliates



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

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


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap