Test syntax coloring
Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: Sample Code
Forum Description: Share Debenu Quick PDF Library sample code with other forum members
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3105
Printed Date: 22 Nov 24 at 6:28PM Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com
Topic: Test syntax coloring
Posted By: mLipok
Subject: Test syntax coloring
Date Posted: 23 Apr 15 at 7:52AM
Func _QPDF_FileSplitEachPage($sPDF_FileFullPath, $sPDF_Password = '', $sDestinationDir = Default, $iNumberOfDigits = 3) If $sDestinationDir = Default Then $sDestinationDir = @ScriptDir & '\Extracted' Local $oQP If _QPDF_CreateObjectAndUnlock($oQP) = 1 Then $oQP.LoadFromFile($sPDF_FileFullPath, $sPDF_Password) ; _QPDF_LastErrorCode($oQP) Local $iTotalPages = _QPDF_FileGetPageCount($sPDF_FileFullPath, '') Local $sPDF_Destination = '' If Not FileExists($sDestinationDir) Then DirCreate($sDestinationDir) Local $aPageFileList[$iTotalPages + 1] $aPageFileList[0] = $iTotalPages
For $n = 1 To $iTotalPages $sPDF_Destination = $sDestinationDir & '\' & StringRegExp($sPDF_FileFullPath, '(?i).*\\(.*?)\.pdf', 3)[0] & '_p' &__QPDF_AddLeadingZeros(String($n), $iNumberOfDigits) & ".pdf" $aPageFileList[$n] = $sPDF_Destination $oQP.ExtractFilePages($sPDF_FileFullPath, '', $sPDF_Destination, $n) Next Return SetError(0, 0, $aPageFileList)
Else Return SetError($__eQPDF_ERROR_DEBENULICENCE, 0, 0)
EndIf EndFunc ;==>_QPDF_FileSplitEachPage
------------- 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
|
Replies:
Posted By: mLipok
Date Posted: 23 Apr 15 at 7:53AM
Func _QPDF_FileSplitEachPage($sPDF_FileFullPath, $sPDF_Password = '', $sDestinationDir = Default, $iNumberOfDigits = 3) If $sDestinationDir = Default Then $sDestinationDir = @ScriptDir & '\Extracted' Local $oQP If _QPDF_CreateObjectAndUnlock($oQP) = 1 Then $oQP.LoadFromFile($sPDF_FileFullPath, $sPDF_Password) ; _QPDF_LastErrorCode($oQP) Local $iTotalPages = _QPDF_FileGetPageCount($sPDF_FileFullPath, '') Local $sPDF_Destination = '' If Not FileExists($sDestinationDir) Then DirCreate($sDestinationDir) Local $aPageFileList[$iTotalPages + 1] $aPageFileList[0] = $iTotalPages
For $n = 1 To $iTotalPages $sPDF_Destination = $sDestinationDir & '\' & StringRegExp($sPDF_FileFullPath, '(?i).*\\(.*?)\.pdf', 3)[0] & '_p' &__QPDF_AddLeadingZeros(String($n), $iNumberOfDigits) & ".pdf" $aPageFileList[$n] = $sPDF_Destination $oQP.ExtractFilePages($sPDF_FileFullPath, '', $sPDF_Destination, $n) Next Return SetError(0, 0, $aPageFileList)
Else Return SetError($__eQPDF_ERROR_DEBENULICENCE, 0, 0)
EndIf EndFunc ;==>_QPDF_FileSplitEachPage
------------- 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
|
Posted By: mLipok
Date Posted: 23 Apr 15 at 7:53AM
Func _QPDF_FileSplitEachPage($sPDF_FileFullPath, $sPDF_Password = '', $sDestinationDir = Default, $iNumberOfDigits = 3) If $sDestinationDir = Default Then $sDestinationDir = @ScriptDir & '\Extracted' Local $oQP If _QPDF_CreateObjectAndUnlock($oQP) = 1 Then $oQP.LoadFromFile($sPDF_FileFullPath, $sPDF_Password) ; _QPDF_LastErrorCode($oQP) Local $iTotalPages = _QPDF_FileGetPageCount($sPDF_FileFullPath, '') Local $sPDF_Destination = '' If Not FileExists($sDestinationDir) Then DirCreate($sDestinationDir) Local $aPageFileList[$iTotalPages + 1] $aPageFileList[0] = $iTotalPages
For $n = 1 To $iTotalPages $sPDF_Destination = $sDestinationDir & '\' & StringRegExp($sPDF_FileFullPath, '(?i).*\\(.*?)\.pdf', 3)[0] & '_p' &__QPDF_AddLeadingZeros(String($n), $iNumberOfDigits) & ".pdf" $aPageFileList[$n] = $sPDF_Destination $oQP.ExtractFilePages($sPDF_FileFullPath, '', $sPDF_Destination, $n) Next Return SetError(0, 0, $aPageFileList)
Else Return SetError($__eQPDF_ERROR_DEBENULICENCE, 0, 0)
EndIf EndFunc ;==>_QPDF_FileSplitEachPage
------------- 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
|
Posted By: mLipok
Date Posted: 28 Apr 15 at 1:53AM
Func _QPDF_FileSplitEachPage($sPDF_FileFullPath, $sPDF_Password = '', $sDestinationDir = Default, $iNumberOfDigits = 3) If $sDestinationDir = Default Then $sDestinationDir = @ScriptDir & '\Extracted' Local $oQP If _QPDF_CreateObjectAndUnlock($oQP) = 1 Then $oQP.LoadFromFile($sPDF_FileFullPath, $sPDF_Password) ; _QPDF_LastErrorCode($oQP) Local $iTotalPages = _QPDF_FileGetPageCount($sPDF_FileFullPath, '') Local $sPDF_Destination = '' If Not FileExists($sDestinationDir) Then DirCreate($sDestinationDir) Local $aPageFileList[$iTotalPages + 1] $aPageFileList[0] = $iTotalPages
For $n = 1 To $iTotalPages $sPDF_Destination = $sDestinationDir & '\' & StringRegExp($sPDF_FileFullPath, '(?i).*\\(.*?)\.pdf', 3)[0] & '_p' &__QPDF_AddLeadingZeros(String($n), $iNumberOfDigits) & ".pdf" $aPageFileList[$n] = $sPDF_Destination $oQP.ExtractFilePages($sPDF_FileFullPath, '', $sPDF_Destination, $n) Next Return SetError(0, 0, $aPageFileList)
Else Return SetError($__eQPDF_ERROR_DEBENULICENCE, 0, 0)
EndIf EndFunc ;==>_QPDF_FileSplitEachPage
------------- 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
|
Posted By: mLipok
Date Posted: 28 Apr 15 at 1:55AM
Func _QPDF_FileSplitEachPage($sPDF_FileFullPath, $sPDF_Password = '', $sDestinationDir = Default, $iNumberOfDigits = 3) If $sDestinationDir = Default Then $sDestinationDir = @ScriptDir & '\Extracted' Local $oQP If _QPDF_CreateObjectAndUnlock($oQP) = 1 Then $oQP.LoadFromFile($sPDF_FileFullPath, $sPDF_Password) ; _QPDF_LastErrorCode($oQP) Local $iTotalPages = _QPDF_FileGetPageCount($sPDF_FileFullPath, '') Local $sPDF_Destination = '' If Not FileExists($sDestinationDir) Then DirCreate($sDestinationDir) Local $aPageFileList[$iTotalPages + 1] $aPageFileList[0] = $iTotalPages
For $n = 1 To $iTotalPages $sPDF_Destination = $sDestinationDir & '\' & StringRegExp($sPDF_FileFullPath, '(?i).*\\(.*?)\.pdf', 3)[0] & '_p' &__QPDF_AddLeadingZeros(String($n), $iNumberOfDigits) & ".pdf" $aPageFileList[$n] = $sPDF_Destination $oQP.ExtractFilePages($sPDF_FileFullPath, '', $sPDF_Destination, $n) Next Return SetError(0, 0, $aPageFileList)
Else Return SetError($__eQPDF_ERROR_DEBENULICENCE, 0, 0)
EndIf EndFunc ;==>_QPDF_FileSplitEachPage
------------- 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
|
Posted By: mLipok
Date Posted: 28 Apr 15 at 1:56AM
Func _QPdf_Example_HelloWorld() Local $sFileName =
@ScriptDir & "\hello-world.pdf" Local $oQP = ObjCreate($__sClassName) If __QPdf_UnlockKey($oQP, $__sLicenseKey) = 1
Then ;~ $oQP.AddPageLabels(1, 1, 10,
'_QPdf_Example_HelloWorld()') $oQP.SetOrigin(1); $oQP.SetTextSize(20); $oQP.DrawText(100, 100, "Hello world from AutoIt") If $oQP.SaveToFile($sFileName) = 1
Then MsgBox($MB_SYSTEMMODAL, "Info", "File " & $sFileName &
" written
successfully.") Else MsgBox($MB_SYSTEMMODAL, "Error", "File " & $sFileName &
" could not be
written.") EndIf $aByteArray = $oQP.SaveToVariant() MsgBox($MB_SYSTEMMODAL, '$oQP.SaveToVariant()',
VarGetType($aByteArray)) Local $fHandle =
FileOpen($sFileName, 16 + 128) $aByteArray2 = FileRead($fHandle) FileClose($fHandle) MsgBox($MB_SYSTEMMODAL, 'Compare results:',
$aByteArray = $aByteArray2) FileDelete(@ScriptDir & '\aByteArray.txt.') FileWrite(@ScriptDir & '\aByteArray.txt.', $aByteArray) FileDelete(@ScriptDir & '\aByteArray2.txt.') FileWrite(@ScriptDir & '\aByteArray2.txt.', $aByteArray2) EndIf
EndFunc ;==>_QPdf_Example_HelloWorld
------------- 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
|
Posted By: mLipok
Date Posted: 28 Apr 15 at 1:57AM
Func _QPdf_Example_HelloWorld()
Local $sFileName = @ScriptDir & "\hello-world.pdf"
Local $oQP = ObjCreate($__sClassName)
If __QPdf_UnlockKey($oQP, $__sLicenseKey) = 1 Then
;~ $oQP.AddPageLabels(1, 1, 10, '_QPdf_Example_HelloWorld()')
$oQP.SetOrigin(1);
$oQP.SetTextSize(20);
$oQP.DrawText(100, 100, "Hello world from AutoIt")
If $oQP.SaveToFile($sFileName) = 1 Then
MsgBox($MB_SYSTEMMODAL, "Info", "File " & $sFileName & " written successfully.")
Else
MsgBox($MB_SYSTEMMODAL, "Error", "File " & $sFileName & " could not be written.")
EndIf
$aByteArray = $oQP.SaveToVariant()
MsgBox($MB_SYSTEMMODAL, '$oQP.SaveToVariant()', VarGetType($aByteArray))
Local $fHandle = FileOpen($sFileName, 16 + 128)
$aByteArray2 = FileRead($fHandle)
FileClose($fHandle)
MsgBox($MB_SYSTEMMODAL, 'Compare results:', $aByteArray = $aByteArray2)
FileDelete(@ScriptDir & '\aByteArray.txt.')
FileWrite(@ScriptDir & '\aByteArray.txt.', $aByteArray)
FileDelete(@ScriptDir & '\aByteArray2.txt.')
FileWrite(@ScriptDir & '\aByteArray2.txt.', $aByteArray2)
EndIf
EndFunc ;==>_QPdf_Example_HelloWorld
------------- 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
|
|