Solved

PDF generation using PHP

Posted on 2004-09-29
3
743 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

786 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