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!
DrawCapturedPageMatrix - Matrix HOWTO ? |
Post Reply |
Author | ||
mLipok
Senior Member Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 449 |
Post Options
Thanks(0)
Posted: 11 Jul 14 at 11:09AM |
|
If I Capture A4 Page
How to draw it using DrawCapturedPageMatrix Can somebody make an example which explain following parameteres: M11 Matrix component M12 Matrix component M21 Matrix component M22 Matrix component MDX Matrix component MDY Matrix component |
||
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 |
||
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
|
Michael,
M11 Matrix component = xscale M12 Matrix component = shear M21 Matrix component = shear M22 Matrix component = yscale MDX Matrix component = xoffset MDY Matrix component = y offset http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf Read the section on coordinate systems. Page 199 to 209. If you are keen to learn the PDF spec then you can read the whole PDF :-) Here is a link for more of the Mathematics. http://mrl.nyu.edu/~dzorin/ig06/lecture05/lecture05.pdf Andrew. |
||
mLipok
Senior Member Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 449 |
Post Options
Thanks(0)
|
|
After long time I just have time to study:
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf For me: the most important description was on page 205 near Figure 4.5 inside "4.2.2 Common Transformations". I will do some functions and after using them, I will share in a future to the "Sample code" in this forum. Cheers, mLipok
|
||
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 |
||
tfrost
Senior Member Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
Post Options
Thanks(0)
|
|
I look forward to your examples! Although I studied mathematics and matrices at school and university, it was a long time ago and some practical guidance on using them in PDF rendering would be most useful.
|
||
jpbro
Senior Member Joined: 29 Mar 11 Status: Offline Points: 77 |
Post Options
Thanks(0)
|
|
I look forward to your examples too!
|
||
mLipok
Senior Member Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 449 |
Post Options
Thanks(0)
|
|
Here you go:
#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 Edited by mLipok - 15 Jun 15 at 10:38AM |
||
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 |
||
mLipok
Senior Member Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 449 |
Post Options
Thanks(0)
|
|
@tfrost , @jpbro
Any comments ? I wonder if you have any constructive ideas. Best regards, mLipok |
||
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 |
||
tfrost
Senior Member Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
Post Options
Thanks(0)
|
|
Sorry, I looked at it, but have been too busy to experiment!
|
||
mLipok
Senior Member Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 449 |
Post Options
Thanks(0)
|
|
So I'll be here waiting patiently for your comment. Cheers, mLipok
|
||
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 |
||
jpbro
Senior Member Joined: 29 Mar 11 Status: Offline Points: 77 |
Post Options
Thanks(0)
|
|
Hi mLipok,
Sorry I've had a very busy few weeks (plus vacation). I'll take a look at your sample tomorrow, thanks a lot for posting it! |
||
jpbro
Senior Member Joined: 29 Mar 11 Status: Offline Points: 77 |
Post Options
Thanks(0)
|
|
Very nice mLipok - the part I wasn't understanding before was the need for radians/cos/tan/etc... to determine the matrix values.
I haven't had a chance to run the code yet because I have to convert it to VB first, but I appreciate the work you've done. Thanks again for posting it! |
||
mLipok
Senior Member Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 449 |
Post Options
Thanks(0)
|
|
You can use it very easy. First download and install AutoIt 3.3.14.0 https://www.autoitscript.com/site/autoit/downloads/ second step: download and install "AutoIt Script Editor" https://www.autoitscript.com/site/autoit-script-editor/downloads/ Now open SciTE, and paste my script to this Editor. Save it as "Example.au3" Download my UDF https://www.autoitscript.com/forum/files/file/342-debenu-quick-pdf-library-udf/ unpack and place QuickPDF.au3 in the same directory when you save "Example.au3" now go to opened "Example.au3" document in SciTE and run it or compile, by using function from menu "Tools". Edited by mLipok - 10 Jul 15 at 7:15PM |
||
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 |
||
mLipok
Senior Member Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 449 |
Post Options
Thanks(0)
|
|
Thanks
You can read this here: http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf Page #205 •Rotations are produced by [ cos θ sin θ −sin θ cos θ 0 0 ], which has the effect of rotating the coordinate system axes by an angle θ counterclockwise. •Skew is specified by [ 1 tan α tan β 1 0 0 ], which skews the x axis by an angle α and the y axis by an angle β. |
||
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 |
||
mLipok
Senior Member Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 449 |
Post Options
Thanks(0)
|
|
Did you look at this ? Could you check this with your mathematical eye ? |
||
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 |
||
mLipok
Senior Member Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 449 |
Post Options
Thanks(0)
|
|
Interesting link:
http://www.planetpdf.com/forumarchive/69809.asp |
||
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 |
||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store