SetLineWidth: Set Line thickness [ 23 ]
Description
Set the width of the subsequent lines to be drawn. This setting impacts the way lines are drawn by the following functions : Cell(), Line(), Rect(), SuperRect(), Elipse(), Polygon(), Sector().
It takes a single parameter which is a float number representing the line thickness to be applied in subsequent drawing functions
C calling syntax
void SetLineWidth (float lw)
Cobol calling syntax
CALL "SetLineWidth" using by value lw.
C sample code
#include "fpdf.h" static char f_ini ??(??) = ??< "ini??/??/demofpdf.ini" ??>; static char f_out ??(??) = ??< "pdf??/??/demo_b.pdf" ??>; /* ----------------------------------------------------------------- */ int main (int argc, char *argv []) ??< int ii; NewPdfy (f_ini, 1); AddPage ("P"); SetLineWidth (0.2); SetFillColor (240, 240, 240); SuperRect (10, 10, 190, 275, "DF", 1, 1, 1, 1); SetDrawColor (16, 64, 240); for (ii = 0; ii < 180; ii ++) { Rotate (ii * 2, 105, 145); Ellipse (105, 145, 30, 90, "D"); } Output (f_out); ??>
Cobol sample code
Procedure division. String 'DD:FINI' Low-Value delimited by size into T0. String 'DD:FINI' Low-Value delimited by size into T0. MOVE NB_PAGES TO I. CALL "NewPdfy" USING BY value Pt0, NB_PAGES. * String 'P' Low-Value delimited by size into T0. Call "AddPage" Using by value Pt0. * MOVE 0.2 TO LW. Call "SetLineWidth" Using by value LW. * MOVE 16 TO R. MOVE 32 TO G. MOVE 240 TO B. Call "SetFillColor" Using by value R,G,B. MOVE 1 TO RADIUS. MOVE 10 TO X. MOVE 10 TO Y. MOVE 190 TO W. MOVE 275 TO H. String 'DF' Low-Value delimited by size into T0. Call "SuperRect" Using by value X,Y,W,H,Pt0,RADIUS,RADIUS,RADIUS,RADIUS. * MOVE 16 TO R. MOVE 32 TO G. MOVE 240 TO B. Call "SetDrawColor" Using by value R,G,B. * MOVE 105 TO X. MOVE 145 TO Y. MOVE 180 TO N. MOVE 0 TO I. PERFORM UNTIL N <= 0 COMPUTE ANGLE = I * 2 Call "Rotate" Using by value Angle,X,Y. Call "Ellipse" Using by value X,Y,RX,RY,T0. SUBTRACT 1 FROM N END-PERFORM. * String 'DD:FOUT' Low-Value delimited by size into T0. Call "Output" Using by value Pt0.
Description of sample code
This piece of code creates an elementary rosette within a rounded corners rectangle, illustrating the use of following functions. - SetLineWidth() --> Set the width of lines to be drawn - SetDrawColor() --> Set the color of lines to be drawn - SetFillColor() --> Set the color of area to be filled - SuperRect() --> Draw a rounded corner rectangle - Ellipse() --> Draw an ellipse - Rotate() --> Rotate the XY coordinates of a given angle around a point
See sample source code in 'C' as well as PDF execution result - NB: For encrypted PDFs, user password is USER-PSWD