GetY: retrieve current Y position   [ 6 ]

Description

This function enables calling programs to retrieve current ordinate position given previous commands which have been issued.  It does not take parameter and it returns a float number.


C calling syntax
float GetY (void)
Cobol calling syntax
Call "GetY" returning Y
C sample code
#include   "fpdf.h"

static char   f_ini ??(??) = ??< "ini??/??/demofpdf.ini" ??>;
static char   f_out ??(??) = ??< "pdf??/??/demo_f.pdf" ??>;
static char   *align ??(??) = ??< "L", "L", "C", "C", "R", "R"??>;
static char   *bordr ??(??) = ??< "LR", "LRTB", "LRTB", "LR" ??>;

/* ----------------------------------------------------------------- */

int  main (int argc, char *argv [])

??<
int     ii, jj;
float   ww ??(??) = ??<30, 25, 40, 25, 25, 35 ??>;
char    bufr ??(128??);
char    *fill;

NewPdfy (f_ini, 1);
AddPage ("P");
SetMargins (10, 10, 10);
SetLineWidth (0.4);
SetFont ("Arial", "BI", 9);
SetDrawColor (160, 0, 0);
SetFillColor (128, 255, 255);
SetTextColor (0, 0, 128);
SetXY (10, 20);
for (ii = 0; ii < 6; ii ++)
   ??<
   sprintf (bufr, "Column #%d", ii);
   Cell (ww ??(ii??), 6, bufr, "1", "0", "C", "1", 0);
   ??>

SetLineWidth (0.2);
SetDrawColor (64, 64, 64);
SetFont ("Courier", "B", 9);
SetTextColor (0, 0, 0);
SetFillColor (240, 240, 240);

SetY (GetY () + 10);
jj = 0;
for (jj = 0; jj < 4; jj ++)
    ??<
    SetX (10);
    SetY (GetY () + 6);
    for (ii = 0; ii < 6; ii ++)
       ??<
       sprintf (bufr, "L%d - C%d", jj, ii);
       Cell (ww ??(ii??), 6, bufr, bordr ??(jj??), "0", align ??(ii??), "0", 0);
       ??>
   ??>

SetY (GetY () + 10);
for ( ; jj < 16; jj ++)
    ??<
    SetX (10);
    SetY (GetY () + 6);
    if ((jj & 1) == 0)
       fill = "1";
    else
       fill = "0";
    for (ii = 0; ii < 6; ii ++)
        ??<
        SetX (GetX () + 1);
        sprintf (bufr, "L%d - C%d", jj, ii);
        Cell (ww ??(ii??) - 1, 6, bufr, "0", "0", align ??(ii??), fill, 0);
        ??>
    ??>


FlushPdf(f_out, 2, "CUST66", "demo_f");
??>
Description of sample code
This programs illustrates various features of Cell functions of FPDF4ZOS.  It opens a PDF context, and creates a six columns table formed of cells.
- Header row features Center aligned Cells with fill and border display.
- Three next data rows are built using four sides borders with various text alignments and border patterns.
- Finally, it builds another set of rows with various text alignments and zebra patterns.  

The following functions are used in this piece:
- NewPdfy()      -->  Initialisation of a pdf context
- AddPage()      -->  As it says
- SetLineWidth() -->  Instruct that PDF is to be protected at user and owner levels
- SetDrawColor() -->  Set the color of lines to be drawn
- SetFillColor() -->  Set the color of area to be filled
- SetFont()      -->  Set current font
- SetMargins()   -->  Specify page margins (left, top, right)
- SetX()         -->  Set X current position
- SetY()         -->  Set Y current position
- GetX()         -->  Get X current position
- GetY()         -->  Get Y current position
- Cell()         -->  Print a Text Cell 
- FlushPdf()     -->  Output PDF file taking into account all the instructions invoked since context initialization
See sample source code in 'C' as well as PDF execution result  -  NB: For encrypted PDFs, user password is USER-PSWD