Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - DrawTextBoxMatrix
  FAQ FAQ  Forum Search   Register Register  Login Login

DrawTextBoxMatrix

 Post Reply Post Reply
Author
Message
dghoskins View Drop Down
Beginner
Beginner


Joined: 30 Jul 13
Location: USA - New Jerse
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote dghoskins Quote  Post ReplyReply Direct Link To This Post Topic: DrawTextBoxMatrix
    Posted: 30 Jul 13 at 3:55PM
Hi,
I just purchased the Quick PDF library and am experimenting with it.  Version 9.15 introduced the DrawTextBoxMatrix function.  The following test program (VBA in MS Access) generates a pdf with the DrawText function and the DrawTextBox function producing visible results.  The DrawTextBoxMatrix does not produce a visible result.  The messagbox indicates that the DrawTextBoxMatrix returns a result of 1.  Am I missing something?

Test Program:

Sub MatrixTest()

    Dim folder, fname As String
    folder = CurrentProject.path & "\"
   
    fname = "Matrix Test.pdf"
   
    Dim xpdf As DebenuPDFLibraryAX0915.PDFLibrary
    Dim hfont, result As Long
    Dim title As String
    Dim tw, ang1, ang2, m12, m21 As Double
   
    Set xpdf = CreateObject("DebenuPDFLibraryAX0915.PDFLibrary")
    If xpdf.UnlockKey("xxxxxxxxxxxxxxxxxxxxxxxxx") = 0 Then
        Exit Sub
    End If
   
    xpdf.SetOrigin (1)
   
    hfont = xpdf.AddStandardFont(4)
   
    title = "Matrix Test"
    xpdf.SetTextSize (24)
    tw = xpdf.GetTextWidth(title)
    Call xpdf.DrawText((xpdf.PageWidth - tw) / 2, 35, title)
    xpdf.SetTextSize (18)

    ang1 = 10
    ang2 = 20
    m12 = Tan(D2R(ang1))
    m21 = Tan(D2R(ang2))
    result = xpdf.DrawTextBoxMatrix(200, 50, "TextBoxMatrix", 0, 1, m12, m21, 1, 320, 100)
    Call xpdf.DrawTextBox(320, 300, 200, 50, "TextBox", 0)
    MsgBox ("Result is " + Str$(result))
    Call xpdf.SaveToFile(folder + fname)
    Set xpdf = Nothing
   
End Sub

Function D2R(ByVal deg As Double) As Double
    D2R = deg / 57.29578
End Function

Function R2D(ByVal rad As Double) As Double
    R2D = rad * 57.29578
End Function


Thanks,
Dennis
Back to Top
kevindebenu View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 16 Apr 12
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote kevindebenu Quote  Post ReplyReply Direct Link To This Post Posted: 01 Aug 13 at 8:16AM
Dennis,

For the new DrawTextBoxMatrix and DrawCapturedPageMatrix functions we decided to keep the matrix entries compatible with the existing DrawImageMatrix function.

With an image the graphic element is interpreted as a 1x1 unit and the matrix scales it to the size it needs to be.

This is the reason DrawTextBoxMatrix includes the first two parameters for the width and height of the untransformed text. The textbox is effectively scaled down to a 1x1 unit that can be transformed to any size/rotation/scale.

So a simple change to your example should give the result you're expecting:

result = xpdf.DrawTextBoxMatrix(200, 50, "TextBoxMatrix", 0, 200, m12, m21, 50, 320, 100)

In this case your matrix only included a rotation so it was easy to change the m11 and m22 entries from 1 to the new width/height. For other matrices you'd need to take your original matrix and multiply it by [ width 0 0 height 0 0 ]

As a test you could try the DrawImageMatrix function (to place a background image onto the page) and then use DrawTextBoxMatrix with the same matrix and the textbox should appear scaled to the same bounds as the image.

Regards,
Kevin
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store