No announcement yet.

How turn label and fields in vertical orientation

  • Filter
  • Time
  • Show
Clear All
new posts

  • How turn label and fields in vertical orientation

    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
    Attached Files

  • #2
    Hi , I founded something about it on the following url:

    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\third \fpdf

    class PDF_Rotate extends FPDF
    var $angle=0;

    function Rotate($angle,$x=-1,$y=-1)
    $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()


    Then within the pdf report which print the wristlabels I inserted a Method called Rotate
    like following


    class PDF extends PDF_Rotate
    function RotatedText($x,$y,$txt,$angle)
    //Text rotated around its origin

    function RotatedImage($file,$x,$y,$w,$h,$angle)
    //Image rotated around its upper-left corner

    $pdf=new PDF();

    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_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\pd freport_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..... !!


    • #3
      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.



      • #4
        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\ra w_printing.php

        The php_printer.dll has got many problems as read in many posts... . with php version and functioning...

        //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 . 'B103100*SATO*';
        $data .= $esc . 'H0170' . $esc . 'V0310' . $esc . 'L0101' . $esc . 'XUSATO';
        $data .= $esc . 'Q1';
        $data .= $esc . 'Z';

        $ret = printer_write($handle, $data);
        //close the printer handle
        Attached Files


        • #5
          Raw data directly to printer....

          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 :


          $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}P0 2{ESC}SPaziente: ";
          $L03="{ESC}%1{ESC}H0360{ESC}V1250{ESC}L0202{ESC}P0 2{ESC}SRep.:"; $L031=" Stanza:"; $L032=" Letto:";
          $L04="{ESC}%1{ESC}H0400{ESC}V1250{ESC}P02{ESC}RDB0 0,32,32,Data nascita: ";
          $L05="{ESC}%2{ESC}H0490{ESC}V1280{ESC}L0101{ESC}P0 3{ESC}S";
          $L08="{ESC}%1{ESC}H0500{ESC}V1200{ESC}L0101{ESC}P1 0{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
          Attached Files


          • #6
            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