473,395 Members | 1,766 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.

please help with this fpdf label printing

Hi

I'm trying to write a label printing routine, but I'm not being too sucsessful. I'm hoping maybe someone who's used FPDF b4 can help me out?

Basically, I want to print labels from a data taken from a MySQL DB, but it doesn't output the labels properly. As soon as it gets to the bottom of the page, it kinda spans the bottom two labels across the two pages. How do I tell it to print the whole last label on the second page? I had a look at the docs, but can't seem to get anything that'll help me.

[PHP]
include_once("classes/fpdf.php");
define('FPDF_FONTPATH','classes/font/');




$pdf=new FPDF('P','mm',$_GET['paper_size']);
$pdf->SetDisplayMode(fullpage);

$pdf->AddPage();

$pdf->SetFont('Arial','B',12);
$pdf->SetAutoPageBreak('on');
$pdf->SetTopMargin(0);
$pdf->SetLeftMargin(0);



$a = $row['name'];
$b = "Expires: ".$row['expire'];
$c = "Take ".$row['dosage'];
$d = "No ".$no." / Pages ".$pages;
$e = $_GET['l_gap']." / ".$_GET['t_gap']." / ".$_GET['width']." / ".$_GET['height'];

$width =$_GET['l_gap'];
$height =$_GET['t_gap'];


for($i=1; $i<$_GET['label_quantity']; $i++) {
//$width = $width+$width+$_GET['v_gap'];
$height = $Ypos+$_GET['h_gap'];

//First Column
$pdf->SetXY($width,$height);
$pdf->MultiCell($_GET['width'], $_GET['height']/10 ,$pdf->GetX()." / ".$pdf->GetY(). " ".$a."\n".$b."\n".$c."\n".$d."\n".$e." #".$i , 1,'L');
$Ypos = $pdf->GetY();
//Second Column
//$pdf->SetXY($_GET['l_gap']+$_GET['width']+$_GET['v_gap'],$height);
//$pdf->MultiCell($_GET['width'], $_GET['height']/10 ,$pdf->GetX()." / ".$pdf->GetY(). " ".$a."\n".$b."\n".$c."\n".$d."\n".$e." #".$i , 1,'L');

}


$pdf->Output();[/PHP]

My other problem, which I don't know howto address yet, is how would I be able to print a few labels next to each other?

tia :)
Attached Files
File Type: pdf output_labels.pdf (3.9 KB, 1200 views)
Dec 22 '05 #1
2 7125
azang
3
I think you can simply adjust the space between the labels. i.e. use $pdf->Ln(5);

[link removed]
Sep 13 '07 #2
I actually just wrote a major application using this. Its very useful but also has a lot of short comings.
Since your data is not dynamically changing in lines you probably can just use the addPage() function from fpdf after the 8th item is printed. This class is not an easy one to use.
Sep 13 '07 #3

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

Similar topics

2
by: john young | last post by:
when settingup a label report in access using the wizard the resulting previw and print out is not as it should be .... example is using Avery labels(or any other). 24 to page ...3col by 8 rows......
2
by: woodensails | last post by:
I have a table with multi objects among which are surname and spouse. This is part of a membership list, I would like to print membership cards for member and spouse. No problem doing separate...
0
by: Gregg | last post by:
Hi All, I have an app that I have written that reads a text file into a SQL database, and then uses that database to generate a variety of mailing labels. All of my laser label formats work just...
4
by: Wayne | last post by:
I have a simple database of addresses each with unique key and the user is able to create a table of selected keys and how many labels they need for each. The print program, using label counting...
1
by: Simon Verona | last post by:
I have the requirement for address label printing within my software. I have a name and address list in a ado.net in-memory dataset - I'd like a pre-built software library which will display a...
3
by: Jlo | last post by:
Hi Gurus, I have a win forms appl in c#. I need to print out labels. What is the best way to do it. I dont want to write the labels to an RTF document and format it by using complicated Drawing...
1
by: devphylosoff | last post by:
hey how to create the page which contains label, point and line which connecting this two items. and do above that user will be able to move the label moreover the line should also move with...
10
by: fieldling | last post by:
I have set up a query and a report using label wizard so that I can print the address details of the current record when viewed on a form. This works fine until I actually need to print: The printer...
25
by: NDayave | last post by:
How do, I have a form that outputs addresses in a format that can be printed on to 3x7 label paper for envelopes. What I want is a way to enter blank (or " ") rows to the query result where the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.