#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#Tidy_Parameters=/sort_funcs /reel
;~ #AutoIt3Wrapper_Run_Debug_Mode=Y
#Region Include
#include-once
#include "QuickPDF.au3"
#EndRegion Include
; SET YOUR LICENSE KEY in your main script using _QPDF_SetLicenseKey()
; If you not set $__sLicenseKey_QPDF then DebenuPDFLibraryLite1114.dll will be used (Lite version) BUT THIS EXAMPLE REQUIRES COMMERCIAL LICENSE.
_QPDF_SetLicenseKey('ENTER YOUR KEY HERE')
; I (mLipok) use MyLicenseKey.txt file to prevent accidentally placed my license key in a public forum.
If FileExists(@ScriptDir & '\MyLicenseKey.txt') Then _QPDF_SetLicenseKey(FileRead(@ScriptDir & '\MyLicenseKey.txt'))
_QPDF_Example_DrawHTMLTextMatrix('ABCDE')
Func _Matrix_Create()
Local $aMatrixTable[6] = [1, 0, 0, 1, 0, 0]
Return $aMatrixTable
EndFunc ;==>_Matrix_Create
Func _Matrix_Move(ByRef $aMatrixTable, $iTx, $iTy)
$aMatrixTable[0] *= 1 ; do not change
$aMatrixTable[1] *= 1 ; do not change
$aMatrixTable[2] *= 1 ; do not change
$aMatrixTable[3] *= 1 ; do not change
$aMatrixTable[4] = $iTx
$aMatrixTable[5] = $iTy
EndFunc ;==>_Matrix_Move
Func _Matrix_Rotate(ByRef $aMatrixTable, $iAngle, $bAsDegree = True, $bAppendMode = False)
Local Const $PI = 3.141592653589793
Local $iRadian = 0
; conversion Degree to Radian
If $bAsDegree Then
; 1° = pi / 180 radians.
; http://www.purplemath.com/modules/radians.htm
$iRadian = ($iAngle * $PI) / 180
Else
$iRadian = $iAngle
EndIf
; Matrix changing
If $bAppendMode Then
$aMatrixTable[0] *= Cos($iRadian)
$aMatrixTable[1] *= Sin($iRadian)
$aMatrixTable[2] *= -Sin($iRadian)
$aMatrixTable[3] *= Cos($iRadian)
Else
$aMatrixTable[0] = Cos($iRadian)
$aMatrixTable[1] = Sin($iRadian)
$aMatrixTable[2] = -Sin($iRadian)
$aMatrixTable[3] = Cos($iRadian)
EndIf
$aMatrixTable[4] *= 1 ; do not change
$aMatrixTable[5] *= 1 ; do not change
EndFunc ;==>_Matrix_Rotate
Func _Matrix_Skew(ByRef $aMatrixTable, $iAngleAlpha, $iAngleBetha, $bAsDegree = True, $bAppendMode = False)
Local Const $PI = 3.141592653589793
Local $iRadianAlpha = 0
Local $iRadianBetha = 0
; conversion Degree to Radian
If $bAsDegree Then
; 1° = pi / 180 radians.
; http://www.purplemath.com/modules/radians.htm
$iRadianAlpha = ($iAngleAlpha * $PI) / 180
$iRadianBetha = ($iAngleBetha * $PI) / 180
Else
$iRadianAlpha = $iAngleAlpha
$iRadianBetha = $iAngleBetha
EndIf
; Matrix changing
$aMatrixTable[0] *= 1 ; do not change
If $bAppendMode Then
$aMatrixTable[1] *= Tan($iRadianAlpha)
$aMatrixTable[2] *= Tan($iRadianBetha)
Else
$aMatrixTable[1] = Tan($iRadianAlpha)
$aMatrixTable[2] = Tan($iRadianBetha)
EndIf
$aMatrixTable[3] *= 1 ; do not change
$aMatrixTable[4] *= 1 ; do not change
$aMatrixTable[5] *= 1 ; do not change
EndFunc ;==>_Matrix_Skew
Func _Matrix_Zoom(ByRef $aMatrixTable, $iSx, $iSy)
$aMatrixTable[0] = $iSx
$aMatrixTable[1] *= 1 ; do not change
$aMatrixTable[2] *= 1 ; do not change
$aMatrixTable[3] = $iSy
$aMatrixTable[4] *= 1 ; do not change
$aMatrixTable[5] *= 1 ; do not change
EndFunc ;==>_Matrix_Zoom
Func _QPDF_DrawHTMLTextMatrix($oQP, $sHTML_Text, $aMatrixTable)
$oQP.DrawHTMLTextMatrix(100, $sHTML_Text, _
$aMatrixTable[0], _
$aMatrixTable[1], _
$aMatrixTable[2], _
$aMatrixTable[3], _
$aMatrixTable[4], _
$aMatrixTable[5])
EndFunc ;==>_QPDF_DrawHTMLTextMatrix
Func _QPDF_Example_DrawHTMLTextMatrix($sHTML_Text)
Local $oQP
If _QPDF_CreateObjectAndUnlock($oQP) = 1 Then
Local $sFileName = @ScriptDir & "\Example_DrawHTMLTextMatrix.pdf"
$oQP.SetOrigin($__eQPDF_SORIGIN_TopLeft);
$oQP.SetMeasurementUnits($__eQPDF_MUNITS_Milimeters)
$sHTML_Text = '<font size="20">' & $sHTML_Text & '</font>'
Local $sHTML_Temp = $sHTML_Text
; normal drawn HTML text
$sHTML_Text = '1. ' & $sHTML_Temp
$oQP.DrawHTMLText(20, 20, 100, $sHTML_Text)
Local $aMatrixTable = _Matrix_Create()
; HTML text drawn with
; moved matrix
$sHTML_Text = '2. ' & $sHTML_Temp
_Matrix_Move($aMatrixTable, 20, 100)
_QPDF_DrawHTMLTextMatrix($oQP, $sHTML_Text, $aMatrixTable)
; HTML text drawn with
; moved zoomed
$sHTML_Text = '3. ' & $sHTML_Temp
_Matrix_Move($aMatrixTable, 40, 200)
_Matrix_Zoom($aMatrixTable, 1.5, 1.5)
_QPDF_DrawHTMLTextMatrix($oQP, $sHTML_Text, $aMatrixTable)
; HTML text drawn with
; moved zoomed
; Rotated 15°
$sHTML_Text = '4. ' & $sHTML_Temp
_Matrix_Move($aMatrixTable, 150, 300)
_Matrix_Zoom($aMatrixTable, 2, 2)
_Matrix_Rotate($aMatrixTable, 15)
_QPDF_DrawHTMLTextMatrix($oQP, $sHTML_Text, $aMatrixTable)
; HTML text drawn with
; moved zoomed
; Rotated 45°
; Skewing 15° for X-axis and -35° for Y-axis
$sHTML_Text = '5. ' & $sHTML_Temp
_Matrix_Move($aMatrixTable, 150, 400)
_Matrix_Zoom($aMatrixTable, 2, 2)
_Matrix_Rotate($aMatrixTable, 45)
_Matrix_Skew($aMatrixTable, 15, -35, True, True)
_QPDF_DrawHTMLTextMatrix($oQP, $sHTML_Text, $aMatrixTable)
; HTML text drawn with
; moved zoomed
; Skewing 0° for X-axis and 45° for Y-axis
_Matrix_Move($aMatrixTable, 150, 550)
_Matrix_Zoom($aMatrixTable, 2, 2)
_Matrix_Skew($aMatrixTable, 0, 45, True, True)
$sHTML_Text = '6. ' & $sHTML_Temp
_QPDF_DrawHTMLTextMatrix($oQP, $sHTML_Text, $aMatrixTable)
; Save PDF to file
$oQP.SaveToFile($sFileName)
While _WinAPI_FileInUse($sFileName)
Sleep(10)
WEnd
; Open PDF
ShellExecuteWait($sFileName)
EndIf
$oQP = 0 ; CleanUp - destroy object
EndFunc ;==>_QPDF_Example_DrawHTMLTextMatrix