It is not a preprinted form. It was created entirely from Access
without using any pdf printer drivers. An Access table was used to
store most of the pdf commands for the invariant part of the form. The
pointing hand and numeral outlines were done using functions. The
variable part (the data) used the values from the form controls in
Courier font to make it look like someone typed the data onto the form.
Here is the module code for the pointing hand:
Public Type Curve
DX As Double
DY As Double
L1 As Double
Alpha As Double
L4 As Double
Beta As Double
End Type
Public Type PiecewiseCurve
Curves(50) As Curve
End Type
Public Function DrawFilledPiecewiseCurve(dblX As Double, dblY As
Double, dblThickness As Double, thePiecewiseCurve As PiecewiseCurve, N
As Integer) As String
Dim I As Integer
Dim J As Integer
Dim strTemp As String
Dim strCR As String
Dim X2 As String
Dim Y2 As String
Dim X3 As String
Dim Y3 As String
Dim X4 As String
Dim Y4 As String
Dim X As Double
Dim Y As Double
Dim dblSumX As Double
Dim dblSumY As Double
Const DegToRad = 0.0174532925
strCR = Chr(13)
strTemp = "%Pointing Hand" & strCR
strTemp = strTemp & "q" & strCR
strTemp = strTemp & CStr(dblThickness) & " w" & strCR
strTemp = strTemp & CStr(dblX) & " " & CStr(dblY) & " m" & strCR
X = dblX
Y = dblY
For I = 1 To N
'Convert the curve into pdf commands
With thePiecewiseCurve.Curves(I)
'Calculate coordinates of P2 and P3
X4 = CStr(X + .DX)
Y4 = CStr(Y + .DY)
X2 = CStr(Round(X + .L1 * Cos(.Alpha * DegToRad), 6))
Y2 = CStr(Round(Y + .L1 * Sin(.Alpha * DegToRad), 6))
X3 = CStr(Round(X4 - .L4 * Cos(.Beta * DegToRad), 6))
Y3 = CStr(Round(Y4 - .L4 * Sin(.Beta * DegToRad), 6))
X = X + .DX
Y = Y + .DY
strTemp = strTemp & X2 & " " & Y2 & " " & X3 & " " & Y3 & " " &
CStr(X4) & " " & CStr(Y4) & " c" & strCR
End With
Next I
'try drawing a line to the starting point
strTemp = strTemp & CStr(dblX) & " " & CStr(dblY) & " l" & strCR
'then fill
strTemp = strTemp & "b S" & strCR
strTemp = strTemp & "Q" & strCR
'Debugging Code
'For J = 1 To 15
' dblSumX = 0
' dblSumY = 0
' For I = 1 To J
' dblSumX = dblSumX + thePiecewiseCurve.Curves(I).DX
' dblSumY = dblSumY + thePiecewiseCurve.Curves(I).DY
' Next I
' strTemp = strTemp & DrawFilledCircle(dblX + dblSumX, dblY + dblSumY,
0.25, 0.93)
'Next J
DrawFilledPiecewiseCurve = strTemp
'MsgBox (Left(strTemp, 100))
End Function
Public Function DrawPointingHand(dblX As Double, dblY As Double, dblH
As Double, dblW As Double) As String
Dim strTemp As String
Dim strCR As String
Dim thePiecewiseCurve As PiecewiseCurve
Dim dblScale As Double
dblScale = 1#
thePiecewiseCurve.Curves(1).Alpha = 30
thePiecewiseCurve.Curves(1).Beta = 10
thePiecewiseCurve.Curves(1).DX = 1# * dblScale
thePiecewiseCurve.Curves(1).DY = 0.108 * dblScale
thePiecewiseCurve.Curves(1).L1 = 0.3 * dblScale
thePiecewiseCurve.Curves(1).L4 = 0.42 * dblScale
thePiecewiseCurve.Curves(2).Alpha = 10
thePiecewiseCurve.Curves(2).Beta = 40
thePiecewiseCurve.Curves(2).DX = 0.4 * dblScale
thePiecewiseCurve.Curves(2).DY = 0.35 * dblScale
thePiecewiseCurve.Curves(2).L1 = 0.17 * dblScale
thePiecewiseCurve.Curves(2).L4 = 0.15 * dblScale
'...
thePiecewiseCurve.Curves(15).Alpha = 120
thePiecewiseCurve.Curves(15).Beta = -160
thePiecewiseCurve.Curves(15).DX = -1.2 * dblScale
thePiecewiseCurve.Curves(15).DY = 0.4 * dblScale
thePiecewiseCurve.Curves(15).L1 = 0.8 * dblScale
thePiecewiseCurve.Curves(15).L4 = 0.9 * dblScale
strTemp = DrawFilledPiecewiseCurve(dblX, dblY, 0.1, thePiecewiseCurve,
15)
DrawPointingHand = strTemp
End Function
James A. Fortune
jimfortune@compumarc.com - 01 Mar 2005 22:30 GMT
> It is not a preprinted form. It was created entirely from Access
> without using any pdf printer drivers. An Access table was used to
BTW, did anyone besides pcdatasheet try out:
http://personalwebs.oakland.edu/~fortune/Histogram.zip
?
James A. Fortune