Hi all,
I’m doing the PDF report of a wristband and I have to turn label and fields content in vertical (90?) .
I mean not all the page but only the fields.
Is there a solution for that question ?? Only barcode field type has a field that ask for orientation.
Many thanks
Giovanni
Hi , I founded something about it on the following url:
http://www.fpdf.org/en/script/script2.php
It’s quite difficult to understand for me how do it but I NEED to make it work.
This is what I did but… without success. ;-( I’m not able configure classes and library in SC … becouse my php skill knoledge level
I copied ‘rotation.php’ here down under
C:\Program Files (x86)\Scriptcase\v71\wwwroot\scriptcase\prod hird\fpdf
require_once(‘fpdf.php’);
class PDF_Rotate extends FPDF
{
var $angle=0;
function Rotate($angle,$x=-1,$y=-1)
{
if($x==-1)
$x=$this->x;
if($y==-1)
$y=$this->y;
if($this->angle!=0)
$this->_out(‘Q’);
$this->angle=$angle;
if($angle!=0)
{
$angle*=M_PI/180;
$c=cos($angle);
$s=sin($angle);
$cx=$x*$this->k;
$cy=($this->h-$y)*$this->k;
$this->_out(sprintf(‘q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm’,$c,$s,-$s,$c,$cx,$cy,-$cx,-$cy));
}
}
function _endpage()
{
if($this->angle!=0)
{
$this->angle=0;
$this->_out(‘Q’);
}
parent::_endpage();
}
}
?>
==============
Then within the pdf report which print the wristlabels I inserted a Method called Rotate
like following
require(‘rotation.php’);
class PDF extends PDF_Rotate
{
function RotatedText($x,$y,$txt,$angle)
{
//Text rotated around its origin
$this->Rotate($angle,$x,$y);
$this->Text($x,$y,$txt);
$this->Rotate(0);
}
function RotatedImage($file,$x,$y,$w,$h,$angle)
{
//Image rotated around its upper-left corner
$this->Rotate($angle,$x,$y);
$this->Image($file,$x,$y,$w,$h);
$this->Rotate(0);
}
}
$pdf=new PDF();
$pdf->AddPage();
$pdf->SetFont(‘Arial’,’’,20);
$pdf->RotatedImage(‘circle.png’,85,60,40,16,45);
$pdf->RotatedText(100,60,‘Hello!’,45);
$pdf->Output();
Always within the pdf report under Code section I added the command to rotate the text without success.
Rotate(90); sc_pdf_print($cell_WARDNAME); Rotate(0);
/------------------ Page 1 -----------------/
sc_pdf_print_img($cell_PATIENTID, 10, 35);
Rotate(90); sc_pdf_print($cell_WARDNAME); Rotate(0);
sc_pdf_print($cell_WARDROOM);
sc_pdf_print($cell_WARDBED);
sc_pdf_print($cell_PATIENTLASTNAME);
sc_pdf_print($cell_PATIENTNAME);
sc_pdf_print($cell_PATIENTBIRTHDAY);
sc_pdf_print_img($cell_PATIENTID_ORR, 80, 10);
/-------------------------------------------/
When I try to run the application this is the error I gave
Fatal error: Class declarations may not be nested in C:\Program Files (x86)\Scriptcase\v71\wwwroot\scriptcase\app\EOS\pdfreport_dbo_Wristband\index.php on line 1200
I’m not a programmer so it’s quite complicated to understand what to do but I need to print wristlabels asap… !!
Bye
Hi,
before diving too deep into this, just an idea.
Why don’t you use the mail_merge thing (without the upload procedure) you did a while ago and adapt it to the situation here?
I mean if you use a word template you can flip and rotate the fields to your heart’s content and you already have a working solution.
The only thing to do would be creating the template and swap out the field names in your code and you are good to go.
I think it’s worth a try.
jsb
Yep, thanks !!!
I would like to try the way you are suggesting too.
Today I’ve also try a direct output test to printer becouse pdf quality of barcode printed is not enough to be read (so labels has no meaning).
Also this way I got other problems (nothing goes straight… I can’t believe it)
Fatal error: Call to undefined function printer_open() in C:\Program Files (x86)\Scriptcase\v71\wwwroot\scriptcase\app\EOS\raw_printing.php
The php_printer.dll has got many problems as read in many posts… . with php version and functioning…
<?php
//open printer
$printer = (“SATO CT408i”);
$handle = printer_open($printer); //or it could be \pcname\printername
//set printing option to raw
printer_set_option($handle, PRINTER_MODE, ?RAW?);
//write data to printer
$esc = chr(27);
$data = ??;
$data .= $esc . ‘A’;
$data .= $esc . ‘A3H1374V0001’;
$data .= $esc . ‘H0050’ . $esc . ‘V0100’ . $esc . ‘L0303’ . $esc . ‘XMSATO’;
$data .= $esc . ‘H0050’ . $esc . ‘V0200’ . $esc . ‘B103100SATO’;
$data .= $esc . ‘H0170’ . $esc . ‘V0310’ . $esc . ‘L0101’ . $esc . ‘XUSATO’;
$data .= $esc . ‘Q1’;
$data .= $esc . ‘Z’;
$ret = printer_write($handle, $data);
//close the printer handle
printer_close($handle);
?>
Raw data directly to printer…
Hi,
I did some tests but unfortunately the request is to go straith to output label wristband printer.
After many and many tests I built a code that print one wristband correctly (see picture). For me it’s like arabs … but it works…
I attached a .prn file that make the job (first part).
Then I come back to SC and did a grid application with a button just to make a test.
This is the button code :
{STX}="\x02";
{ETX}="\x03";
{ESC}="\x1B";
$L01="{STX}{ESC}A {ESC}EX0 {ESC}AR {ESC}A3H001V001 {ESC}CS3 {ESC}#E4 {ESC}A115000720 {ESC}Z{ETX}{STX}{ESC}A {ESC}PS {ESC}WK EOS SBPL.lbl “;
$L02=”{ESC}%1{ESC}H0320{ESC}V1250{ESC}L0202{ESC}P02{ESC}SPaziente: “;
$L03=”{ESC}%1{ESC}H0360{ESC}V1250{ESC}L0202{ESC}P02{ESC}SRep.:"; $L031=" Stanza:"; $L032=" Letto:";
$L04="{ESC}%1{ESC}H0400{ESC}V1250{ESC}P02{ESC}RDB00,32,32,Data nascita: “;
$L05=”{ESC}%2{ESC}H0490{ESC}V1280{ESC}L0101{ESC}P03{ESC}S";
$L06="{ESC}%0{ESC}H0308{ESC}V1300{ESC}BG01050>G";
$L07="{ESC}%1{ESC}H0440{ESC}V1250{ESC}BG02050>G";
$L08="{ESC}%1{ESC}H0500{ESC}V1200{ESC}L0101{ESC}P10{ESC}M";
$L09="{ESC}/01 {ESC}~A0 {ESC}Q1 {ESC}Z{ETX} ";
$sato= $L01.$L02.‘LASTNAME’.’ '.‘FIRSTNAME’ . $L03 . ‘PEDIATRIA AAAA’ . $L031 .
‘ST 603’ . $L032 . ‘10’ . $L04 . ‘01/10/2000’ . $L05 . ‘FISCAL CODE TXT OR’ . $L06 .
‘FISCAL CODE OR’ . $L07 . ‘FISCAL CODE VE’ . $L08 . ‘FISCAL CODE TXT VE’ . $L09 ;
echo $sato;
Always on the attached .prn file there is the copied result (2nd part) of the SC echo command.
More or less it’s similar but all the escape have a blank space that original program do not have.
Is there a way to eliminate them and have the same original code to send to a .prn file and to printer ??
Once fix this point then I have to substiture fixed text of label with variables and… another great effort for me !!
I need to make a loop that make a label for each record of the query did over db… Help me to start the loop ;-))
Many thanks
eos2_mod_sato_Forum.prn.txt (995 Bytes)
Hi Giovannino,
I’m trying to use php_printer.dll but without success : I get this message
Fatal error: Call to undefined function printer_open() in…
I added : extension=php_printer.dll in php.ini
put this dll in ext directory
but doesn’t work …
How did you resolve this ?
Thanks for your help
Nac