Solved

PDF generation using PHP

Posted on 2004-09-29
3
741 Views
Last Modified: 2008-03-10
Hello,

Iam using "ezpdf" for creating pdf doc.
here is the url.

on the second page i use the base class function "addTextWrap" for writing rotated text.
but this does not maintain the text formatting such as line breaks,

there is a function  
function ezProcessText($text){
  // this function will intially be used to implement underlining support, but could be used for a range of other
  // purposes
  $search = array('<u>','<U>','</u>','</U>');
  $replace = array('<c:uline>','<c:uline>','</c:uline>','</c:uline>');
  return str_replace($search,$replace,$text);
}

which i think is used for underlining text in pdf format..

so is there any tag like <c:uline> for line breaks in PDF?

0
Comment
Question by:sandeepaher
  • 2
3 Comments
 
LVL 27

Expert Comment

by:Diablo84
ID: 12178945
I would imagine pdf's recognise the \n as new line so try

function ezProcessText($text){
  // this function will intially be used to implement underlining support, but could be used for a range of other
  // purposes
  $search = array('<u>','<U>','</u>','</U>');
  $replace = array('<c:uline>','<c:uline>','</c:uline>','</c:uline>');
  $text = str_replace($search,$replace,$text);
  $text = str_replace("<br>","\n",$text);
  return $text;
}

not 100% sure on that one
0
 

Author Comment

by:sandeepaher
ID: 12179005
\n
this doesnt work.

 is there any tag like <c:uline> for line breaks in PDF?
0
 
LVL 27

Accepted Solution

by:
Diablo84 earned 500 total points
ID: 12180338
Not that i am aware of if \n does not work.

I have just had a quick look through the class file, prehaps you can work around the problem by using effective paragraphing, that is to say making multiple calls to the function that adds text to the pdf, ezText. I haven't looked at this package before today so whether or not this is feasible i cannot say for sure, prehaps the folks in the Acrobat Reader TA would be able to shed some light on how PDF's handles line breaks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now