* PROGRESS 4GL code to enhance PDFinclude by Md. Amzad Hossain
Ellipse Procedure to use with PDFinclude.
If you need pdfinclude Linux version or facing problem with OpenEdge 10.1B please contact us – we can solve your PDF reporting problems.
Ellipse Procedure for PDFinclude
1. Add this procedure with pdf_inc.p file of PDFinclude
2.Call this procedure in your PROGRESS 4GL application
Example:
RUN pdf_stroke_color(“Spdf”,.8,0,0).
RUN pdf_stroke_fill(“Spdf”,.8, 0, 0).
RUN pdf_ellipse(“Spdf”,117,735,80,34,0.3122847498,0). /* X,Y,a,b,accentricity,border */
PROCEDURE pdf_ellipse :
/* Note: pdfX and pdfY represent the center point of the ellipse. These
values become the new Graphic X and Y points after the drawing of
the ellipse. If you want the ellipse to be filled use pdf_stroke_fill
*/
DEFINE INPUT PARAMETER pdfStream AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pdfX AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER pdfY AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER pdf_a AS INTEGER NO-UNDO. /* we will use this for major axis */
DEFINE INPUT PARAMETER pdf_b AS INTEGER NO-UNDO. /* we will use this for minor axis */
DEFINE INPUT PARAMETER eccentricity AS DEC NO-UNDO. /* we will use this for eccentricity, in general it will control the oval shape of the ellipse */
DEFINE INPUT PARAMETER pdfWeight AS DECIMAL NO-UNDO.
/* DEFINE VARIABLE eccentricity AS DECIMAL DECIMALS 10 NO-UNDO. */
/* i will use this for eccentricity of the ellipse – it will control the shape of the ellipse */
DEFINE VARIABLE l_Length AS DECIMAL DECIMALS 5 NO-UNDO.
DEFINE VARIABLE c_NewY AS CHARACTER NO-UNDO.
DEFINE VARIABLE c_NewX AS CHARACTER NO-UNDO.
IF NOT CAN-FIND(FIRST TT_pdf_stream
WHERE TT_pdf_stream.obj_stream = pdfStream NO-LOCK)
THEN DO:
RUN pdf_error(pdfStream,”pdf_ellipse”,”Cannot find Stream!”).
RETURN.
END.
l_Length = pdf_a * eccentricity.
/* First Quadrant – Upper Right */
c_NewX = dec2string(l_Length + pdfX).
c_NewY = dec2string(l_Length + pdfY).
RUN pdf_move_to(pdfStream, pdfX + pdf_a, pdfY).
RUN pdf_curve(pdfStream,
pdfX + pdf_a,
c_newY,
c_NewX,
pdfY + pdf_b,
pdfX,
pdfY + pdf_b,
pdfWeight).
/* Second Quadrant – Upper Left */
c_NewX = dec2string(pdf_GraphicX(pdfstream) – l_Length).
c_NewY = dec2string(pdf_GraphicY(pdfstream) – pdf_b + l_Length).
RUN pdf_curve(pdfStream,
c_NewX,
pdf_GraphicY(pdfStream),
pdfX – pdf_a,
c_NewY,
pdfX – pdf_a,
pdf_GraphicY(pdfStream) – pdf_b,
pdfWeight).
/* Third Quadrant – Lower Left */
c_NewX = dec2string(pdfX – l_Length).
c_NewY = dec2string(pdfY – l_Length).
RUN pdf_curve(pdfStream,
pdfX – pdf_a,
c_NewY,
c_newX,
pdfY – pdf_b,
pdfX,
pdfY – pdf_b,
pdfWeight).
/* Fourth Quadrant – Lower Right */
c_NewX = dec2string(pdfX + l_Length).
c_NewY = dec2string(pdfY – l_Length).
RUN pdf_curve(pdfStream,
c_NewX,
pdfY – pdf_b,
pdfX + pdf_a,
c_NewY,
pdfX + pdf_a,
pdfY,
pdfWeight).
/* Close the Path */
RUN pdf_close_path(pdfStream).
/* Set the current point to be the current Graphic X/Y Location */
RUN pdf_set_GraphicY (pdfStream,pdfY).
RUN pdf_set_GraphicX (pdfStream, pdfX).
END. /* pdf_ellipse */
/* enjoy! it’s fun a lot – by Amzad, March 24 2007, amzad@teksea.com */