\FF\D8\FF\E0\00JFIF\00\00\00d\00d\00\00\FF\FE\00\border bs:0 bc:#000000 ps:0 pc:#ffffff es:0 ec:#000000 ck:feee6c715d26fd9f38b0ca4278c05026\FF\DB\00C\00P7<F<2PFAFZUP_xxnnx\F5\AF\B9\91\C8\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\DB\00CUZZxix‚\EB\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\C0\00\00b\00d\00\FF\C4\00\00\00\00\00\00\00\00\00\00\00\00\00\00\FF\C4\00\00\00\00\00\00\00\00\00\00\001A!Q\FF\C4\00\00\00\00\00\00\00\00\00\00\00\00\00\FF\C4\00\00\00\00\00\00\00\00\00\00!1AQ\FF\DA\00\00\00?\00\F6\00\00\00\00\00\00\00\00\00\00\A0\00\00\C5\CF\F8\E7Ó\FCjD~\B9^\AD\%\B3]\D8cs-\BBs,-\A0\00"\80\00%\B83rÏ^K~F\A4ea\00E\00\C6\EE=u\B1\9B\D1\00@\00r\BE8\F9:\FE5#.M\00\E7\CB\C9q\CBq\D6\F2\BE\B7\C7>\C9n5×\D6?\BDê\9Ds\EBp\9F[`8m\B7)o\B5\E8\E6I\99\FE3]]A2\BA\8Cw\D6E\93\\DEv\C8\009\F2\F1NI?uc\\F5\EA\96k\xN<~buv\EA\C8\D7	\8B\84\CEcxI\BBg\AE\9E=\D6+n\EC\80\C8A\8C\AE\EB\CF\D5\DA\E9"2\A4\B9j5\EB\F3W\B63\96\B30Yu\DA\FC8\ED\DF\E7Ms\FB\F1\8E\B3\FA\EA\E8\E6(\883zs\F2_\8DFk\8Bh
\00\8C\DCw\D3R\B5+6X\BA\B2\C4j\AB0\B4\FCMw\C2I\8E\9B\E3\A9~9u\FA\D3l\80\C8%p\EE\FDn2€
\00$\FEj\C4e\A9\DB\~\95\A7\A5\80EK\BB\8DDsP\00@@AD'k\CF\E8\DB\D2(\80\9AK\D3\85\D6lb\F2\BA\8C*\80\00)\95
59\A3R:\F3\CE"\B6\80\88\00\00i1u4ê\E9\F2á\A6\A2\FACM\93WMb*\E0*\00\00\00\00\00(\A8\80\00\00\80\00\00\00\00\00\00\00\00\00\FF\D9<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>C///</title>
</head>
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  '¨t²Î¹w³]­È
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   1185
      Left            =   960
      TabIndex        =   0
      Top             =   870
      Width           =   2595
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
    Dim page_title  As String

    Dim pdf         As Long
    Dim font        As Long
    Dim page        As Long
    Dim fname       As String * 256

    Dim samp_text   As String
    Dim samp_text2  As String
    Dim tw          As Single
    Dim fsize       As Single
    Dim i           As Long
    Dim length      As Long

    Dim angle1      As Single
    Dim angle2      As Single
    Dim rad1        As Single
    Dim rad2        As Single
    Dim r           As Single
    Dim g           As Single
    Dim b           As Single

    Dim ypos        As Single
    
    page_title = "Text Demo"
    samp_text = "abcdefgABCDEFG123!#$%&+-@?"
    samp_text2 = "The quick brown fox jumps over the lazy dog."

    
    fname = App.Path & IIf(Right(App.Path, 1) = "\", "", "\") & "text_demo.pdf"
    
    pdf = HPDF_New(AddressOf error_handler, ByVal vbNullString)
    
    If pdf = 0 Then
        'printf ("error: cannot create PdfDoc object\n")
        Exit Sub
    End If

    '/* set compression mode */
    Call HPDF_SetCompressionMode(pdf, HPDF_COMP_ALL)

    '/* create default-font */
    sTemp1 = "Helvetica" '& Chr(0)
    font = HPDF_GetFont(pdf, ByVal sTemp1, ByVal vbNullString)
    'Dim stemp   As string
    'stemp = HPDF_LoadTTFontFromFile(pdf, ByVal "c:\windows\fonts\arial.ttf", HPDF_TRUE)
    
    '/* add a new page object. */
    page = HPDF_AddPage(pdf)

    '/* draw grid to the page */
    'Call print_grid(pdf, page)

    '/* print the lines of the page.
    Call HPDF_Page_SetLineWidth(page, 1)
    Call HPDF_Page_Rectangle(page, 50, 50, HPDF_Page_GetWidth(page) - 100, HPDF_Page_GetHeight(page) - 110)
    Call HPDF_Page_Stroke(page)
    
    '/* print the title of the page (with positioning center). */
    Call HPDF_Page_SetFontAndSize(page, font, 24)
    tw = HPDF_Page_TextWidth(page, ByVal page_title)
    Call HPDF_Page_BeginText(page)
    Call HPDF_Page_TextOut(page, (HPDF_Page_GetWidth(page) - tw) / 2, HPDF_Page_GetHeight(page) - 50, ByVal page_title)
    Call HPDF_Page_EndText(page)

    Call HPDF_Page_BeginText(page)
    Call HPDF_Page_MoveTextPos(page, 60, HPDF_Page_GetHeight(page) - 60)

    '/*
    ' * font size
    ' */
    Dim buf     As String * 50
    fsize = 8
    Do While (fsize < 60)

        '/* set style and size of font. */
        Call HPDF_Page_SetFontAndSize(page, font, fsize)

        '/* set the position of the text. */
        Call HPDF_Page_MoveTextPos(page, 0, -5 - fsize)

        '/* measure the number of characters which included in the page. */
        'strcpy(buf, samp_text)
        samp_text = buf
        length = HPDF_Page_MeasureText(page, samp_text, HPDF_Page_GetWidth(page) - 120, HPDF_FALSE, 0&)

        '/* truncate the text. */
        'buf(length) = &H0

        Call HPDF_Page_ShowText(page, buf)

        '/* print the description. */
        Call HPDF_Page_MoveTextPos(page, 0, -10)
        Call HPDF_Page_SetFontAndSize(page, font, 8)
        buf = "Fontsize=" & Format(fsize, "0.0")
        Call HPDF_Page_ShowText(page, buf)

        fsize = fsize * 1.5
    Loop

    '/*
    ' * font color
    ' */
    Call HPDF_Page_SetFontAndSize(page, font, 8)
    Call HPDF_Page_MoveTextPos(page, 0, -30)
    Call HPDF_Page_ShowText(page, "Font color")

    Call HPDF_Page_SetFontAndSize(page, font, 18)
    Call HPDF_Page_MoveTextPos(page, 0, -20)
    length = Len(samp_text)
    
    Dim buf1 As String * 2
    For i = 0 To length
        r = i / length
        g = 1 - (i / length)
        CopyMemory ByVal buf1, VarPtr(samp_text) + i, 1
        'buf[1] = 0x00

        Call HPDF_Page_SetRGBFill(page, r, g, 0#)
        Call HPDF_Page_ShowText(page, buf1)
    Next i
    Call HPDF_Page_MoveTextPos(page, 0, -25)

    For i = 0 To length
        r = i / length
        b = 1 - (i / length)
        CopyMemory ByVal buf1, VarPtr(samp_text) + i, 1
        'buf[1] = 0x00

        Call HPDF_Page_SetRGBFill(page, r, 0#, b)
        Call HPDF_Page_ShowText(page, buf1)
    Next i
    Call HPDF_Page_MoveTextPos(page, 0, -25)

    For i = 0 To length
        b = i / length
        g = 1 - (i / length)
        CopyMemory ByVal buf1, VarPtr(samp_text) + i, 1
        'buf[1] = 0x00

        Call HPDF_Page_SetRGBFill(page, 0#, g, b)
        Call HPDF_Page_ShowText(page, buf)
    Next i

    HPDF_Page_EndText (page)

    ypos = 450

    '/*
    ' * Font rendering mode
    ' */
    Call HPDF_Page_SetFontAndSize(page, font, 32)
    Call HPDF_Page_SetRGBFill(page, 0.5, 0.5, 0#)
    Call HPDF_Page_SetLineWidth(page, 1.5)

     '/* PDF_FILL */
    Call show_description(page, 60, ypos, "RenderingMode=PDF_FILL")
    Call HPDF_Page_SetTextRenderingMode(page, HPDF_FILL)
    Call HPDF_Page_BeginText(page)
    Call HPDF_Page_TextOut(page, 60, ypos, "ABCabc123")
    Call HPDF_Page_EndText(page)

    '/* PDF_STROKE */
    Call show_description(page, 60, ypos - 50, "RenderingMode=PDF_STROKE")
    Call HPDF_Page_SetTextRenderingMode(page, HPDF_STROKE)
    Call HPDF_Page_BeginText(page)
    Call HPDF_Page_TextOut(page, 60, ypos - 50, "ABCabc123")
    Call HPDF_Page_EndText(page)

    '/* PDF_FILL_THEN_STROKE */
    Call show_description(page, 60, ypos - 100, "RenderingMode=PDF_FILL_THEN_STROKE")
    Call HPDF_Page_SetTextRenderingMode(page, HPDF_FILL_THEN_STROKE)
    Call HPDF_Page_BeginText(page)
    Call HPDF_Page_TextOut(page, 60, ypos - 100, "ABCabc123")
    Call HPDF_Page_EndText(page)

    '/* PDF_FILL_CLIPPING */
    Call show_description(page, 60, ypos - 150, "RenderingMode=PDF_FILL_CLIPPING")
    Call HPDF_Page_GSave(page)
    Call HPDF_Page_SetTextRenderingMode(page, HPDF_FILL_CLIPPING)
    Call HPDF_Page_BeginText(page)
    Call HPDF_Page_TextOut(page, 60, ypos - 150, "ABCabc123")
    Call HPDF_Page_EndText(page)
    Call show_stripe_pattern(page, 60, ypos - 150)
    Call HPDF_Page_GRestore(page)

    '/* PDF_STROKE_CLIPPING */
    Call show_description(page, 60, ypos - 200, "RenderingMode=PDF_STROKE_CLIPPING")
    Call HPDF_Page_GSave(page)
    Call HPDF_Page_SetTextRenderingMode(page, HPDF_STROKE_CLIPPING)
    Call HPDF_Page_BeginText(page)
    Call HPDF_Page_TextOut(page, 60, ypos - 200, "ABCabc123")
    Call HPDF_Page_EndText(page)
    Call show_stripe_pattern(page, 60, ypos - 200)
    Call HPDF_Page_GRestore(page)

    '/* PDF_FILL_STROKE_CLIPPING */
    Call show_description(page, 60, ypos - 250, "RenderingMode=PDF_FILL_STROKE_CLIPPING")
    Call HPDF_Page_GSave(page)
    Call HPDF_Page_SetTextRenderingMode(page, HPDF_FILL_STROKE_CLIPPING)
    Call HPDF_Page_BeginText(page)
    Call HPDF_Page_TextOut(page, 60, ypos - 250, "ABCabc123")
    Call HPDF_Page_EndText(page)
    Call show_stripe_pattern(page, 60, ypos - 250)
    Call HPDF_Page_GRestore(page)

    '/* Reset text attributes */
    Call HPDF_Page_SetTextRenderingMode(page, HPDF_FILL)
    Call HPDF_Page_SetRGBFill(page, 0, 0, 0)
    Call HPDF_Page_SetFontAndSize(page, font, 30)


    '/*
    ' * Rotating text
    ' */
    angle1 = 30                   '/* A rotation of 30 degrees. */
    rad1 = angle1 / 180 * 3.141592 '/* Calcurate the radian value. */

    Call show_description(page, 320, ypos - 60, "Rotating text")
    Call HPDF_Page_BeginText(page)
    Call HPDF_Page_SetTextMatrix(page, Cos(rad1), Sin(rad1), -Sin(rad1), Cos(rad1), 330, ypos - 60)
    Call HPDF_Page_ShowText(page, "ABCabc123")
    Call HPDF_Page_EndText(page)


    '/*
    ' * Skewing text.
    ' */
    Call show_description(page, 320, ypos - 120, "Skewing text")
    Call HPDF_Page_BeginText(page)

    angle1 = 10
    angle2 = 20
    rad1 = angle1 / 180 * 3.141592
    rad2 = angle2 / 180 * 3.141592

    Call HPDF_Page_SetTextMatrix(page, 1, Tan(rad1), Tan(rad2), 1, 320, ypos - 120)
    Call HPDF_Page_ShowText(page, "ABCabc123")
    Call HPDF_Page_EndText(page)


    '/*
    ' * scaling text (X direction)
    ' */
    Call show_description(page, 320, ypos - 175, "Scaling text (X direction)")
    Call HPDF_Page_BeginText(page)
    Call HPDF_Page_SetTextMatrix(page, 1.5, 0, 0, 1, 320, ypos - 175)
    Call HPDF_Page_ShowText(page, "ABCabc12")
    Call HPDF_Page_EndText(page)


    '/*
    ' * scaling text (Y direction)
    ' */
    Call show_description(page, 320, ypos - 250, "Scaling text (Y direction)")
    Call HPDF_Page_BeginText(page)
    Call HPDF_Page_SetTextMatrix(page, 1, 0, 0, 2, 320, ypos - 250)
    Call HPDF_Page_ShowText(page, "ABCabc123")
    Call HPDF_Page_EndText(page)


    '/*
    ' * char spacing, word spacing
    ' */

    Call show_description(page, 60, 140, "char-spacing 0")
    Call show_description(page, 60, 100, "char-spacing 1.5")
    Call show_description(page, 60, 60, "char-spacing 1.5, word-spacing 2.5")

    Call HPDF_Page_SetFontAndSize(page, font, 20)
    Call HPDF_Page_SetRGBFill(page, 0.1, 0.3, 0.1)

    '/* char-spacing 0 */
    Call HPDF_Page_BeginText(page)
    Call HPDF_Page_TextOut(page, 60, 140, ByVal samp_text2)
    Call HPDF_Page_EndText(page)

    '/* char-spacing 1.5 */
    Call HPDF_Page_SetCharSpace(page, 1