Search the Community
Showing results for tags 'pdf'.
-
I would like to present, the UDF for Debenu Quick PDF Library Getting Started: http://www.debenu.com/products/development/debenu-pdf-library/getting-started/getting-started-activex-edition/ Function Reference: http://www.debenu.com/docs/pdf_library_reference/FunctionGroups.php Useful information: http://www.quickpdf.org/forum/quickpdf-the-first-steps_topic1242.html http://www.quickpdflibrary.com/blog/2011/02/the-basics-getting-familiar-with-quick-pdf-library/ First time installing Debenu Quick PDF Library: You can download demo here: http://www.quickpdflibrary.com/downloads/quick_pdf_library_demo.exe Requirements: file "DebenuPDFLibraryLite1012.dll" or "DebenuPDFLibraryAX1014.dll" must be in @ScriptDir if you want to try you must download it from here: http://www.debenu.com/products/development/debenu-pdf-library/trial/ or http://www.debenu.com/products/development/debenu-pdf-library-lite/free/ after install you can find this dll in: "c:\Program Files (x86)\DebenuPDF Library\ActiveX\DebenuPDFLibraryAX1014.dll" or "c:\Program Files (x86)\DebenuPDF Library\Lite\DebenuPDFLibraryLite1012.dll" !!! you can change DLL to newer version using _QPDF_NewLibraryPath_Commercial() EDIT: actualy (19-06-2015) there is DebenuPDFLibraryAX1115.dll and DebenuPDFLibraryLite1115.dll to use the commercial version you need to use the _QPdf_SetLicenseKey()AutoIt 3.3.10.2++For UDF and examples download, and the current version information please go to download section: The following information are outdated 2014-05-14: 2014/05/14 v0.3 * removed examples from QuickPDF.au3 * added separate file with examples QuickPDF_Examples.au3 * added _QPDF_StartUp() * added _QPDF_NewLibraryPath_Commercial() * added _QPDF_NewLibraryPath_Lite() * __AddLeadingZeros changedt to __QPDF_AddLeadingZeros * CleanUp * _QPdf_ changed to _QPDF_ * Function Header - significantly supplemented * additional comments * new set of enum constants!!!!!!!!!!!!!!! SCRIPT BREAKING CHANGE !!!!!!!!!!!!!!! * Lite Function renaming to change your script you can use: ClipPut(StringRegExpReplace(ClipGet(),'(?i)(_QPDF)(_Lite)(_.*?)((|R)','$1$3$2$4')) * all functions which starts with "_QPDF__" now starts with "_QPDF_" it means one less "_" * _QPDF_FileSplitEachPage added new Parameters $sPDF_Password (as a second not third so $sDestinationDir is moved to third position * __QPDF_CreateObjectAndUnlock($oQP) change to _QPDF_CreateObjectAndUnlock($oQP) its mean is not internal any more =================================================== 2014-05-31: 2014/05/31 v0.4 QuickPDF.au3 * in __QPDF_UnlockKey() - Remarks changed * in _QPDF_StartUp() fixed: 'If Not FileExists($sDLLFile) Then' removed 'Not' * because of this process did not work on systems where the library was not registered using regsvr32.exe. * in _QPDF_StartUp() added: return values, but their functionality is not yet implemented and described (be expected to change within a week) * Added: new function: _QPDF_PrintPDFFile([$sPDF_FileFullPath = Default[, $sPDFPassword = ''[, $iDuplex = 1 ]]]) * Added: new function: _QPDF_MergeFiles($sFirstFileName, $sSecondFileName[, $sOutputFileName = Default]) QuickPDF_Examples.au3 * new example _QPDF_Example_MergeFiles() 2014/05/31 v0.5 QuickPDF.au3 * FIXED: in _QPDF_PrintPDFFile now printing all pages not only the first one 2014-07-02 NEW VERSION: 2014/07/02 v0.6 QuickPDF.au3 * added: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 and script CleanUp * added: new function _QPDF_ExtractTextFromStream() - you can use this function when you have data taken from Blob from SQL databese * added: new parameters _QPDF_NewLibraryPath_Commercial($sLibrary_NewFileFullPath, $sNewClassName, $sNewCLSID, $sNewIID) * #Region renaming - for better usage in SciTE Jump * in _QPDF_MergeFiles() -- litle change in $sOutputFileName = Default - add & '_temp.pdf' instead 'temp.pdf' * Changed: _QPDF_LastErrorCode -- Return Value containg description (string) and @error contain LastErrorCode * Changed: _QPDF_ExtractTextFromFile dafult $iExtractOptions = 7 for detail see here : http://www.quickpdf.org/forum/extractfilepagetext-options-0-and-8_topic2929.html * Removed: some MsgBox * Fixed: _QPDF_StartUp() - error checking for DllOpen QuickPDF_Examples.au3 * added: using new function _QPDF_NewLibraryPath_Commercial() for this you need DebenuPDFLibraryAX1015.dll _QPDF_NewLibraryPath_Commercial(@ScriptDir & 'DebenuPDFLibraryAX1015.dll', 'DebenuPDFLibraryAX1015.PDFLibrary', '{5D4196E9-0A7D-48DC-BD2C-7CD3FE771B38}', '{FA7270CF-D774-4A68-8368-2C3179895E0C}') QuickPDF_Calltip_Generator.au3 * NEW: use it to generate au3.QuickPDF.calltips.api OLD INFO: Before: 2014-05-05 OLD: Before: 2014-05-05 I'm working on UDF for http://www.quickpdf.org/ http://www.debenu.com/products/development/debenu-pdf-library/trial/ http://www.debenu.com/products/development/debenu-pdf-library/getting-started/getting-started-activex-edition/ For now I'm learning on the basis of examples of documentation: http://www.debenu.com/products/development/debenu-pdf-library/help/developer-guide/ http://www.debenu.com/docs/pdf_library_developer_guide/debenu_quick_pdf_library_10_developer_guide.pdf here is what I have: #include <MsgBoxConstants.au3> Global $__sClassName = "DebenuPDFLibraryAX1014.PDFLibrary" Global $__sLicenseKey = "....." ;'SET YOUR LICENSE KEY HERE... #CS C:\Windows\SysWOW64>regsvr32 "C:\Program Files\Debenu\PDF Library\ActiveX\DebenuPDFLibraryAX1014.dll" C:\Windows\SysWOW64>regsvr32 "c:\Program Files (x86)\Debenu\PDF Library\ActiveX\DebenuPDFLibrary64AX1014.dll" #CE _QPdf_Example_HelloWorld() _QPdf_Example_PrintDefault() Func __QPdf_UnlockKey($oQPdf, $sLicenseKey = Default) If $sLicenseKey = Default Then $sLicenseKey = $__sLicenseKey EndIf Local $Result = $oQPdf.UnlockKey($__sLicenseKey) If $Result <> 1 Then MsgBox($MB_SYSTEMMODAL, "info", "Invalid license key. Please set your license key by editing this file.") EndIf Return $Result EndFunc ;==>__QPdf_UnlockKey Func _QPdf_Example_HelloWorld() Local $sFileName = @ScriptDir & "\hello-world.pdf" Local $oQPdf = ObjCreate($__sClassName) If __QPdf_UnlockKey($oQPdf, $__sLicenseKey) = 1 Then ConsoleWrite("Library version: " & $oQPdf.LibraryVersion & @CRLF) ConsoleWrite("License Info: " & $oQPdf.LicenseInfo & @CRLF) $oQPdf.SetOrigin(1); $oQPdf.SetTextSize(20); $oQPdf.DrawText(100, 100, "Hello world from AutoIt") $oQPdf.SetTextSize(25); $oQPdf.DrawText(100, 200, "Hello world from AutoIt") $oQPdf.SetTextSize(30); $oQPdf.DrawText(100, 300, "Hello world from AutoIt") $oQPdf.SetTextSize(60); $oQPdf.SetTextColor(0, 0.5, 1); $oQPdf.DrawText(100, 400, "Hello world from AutoIt") If $oQPdf.SaveToFile($sFileName) = 1 Then MsgBox($MB_SYSTEMMODAL, "Info", "File " & $sFileName & " written successfully.") Else MsgBox($MB_SYSTEMMODAL, "Error", "File " & $sFileName & " could not be written.") EndIf EndIf EndFunc ;==>_QPdf_Example_HelloWorld Func _QPdf_Example_PrintDefault() ; based on Debenu Quick PDF Library 10 Developer Guide.pdf ; Standard PDF printing Local $sFileName = @ScriptDir & "\hello-world.pdf" Local $oQPdf = ObjCreate($__sClassName) If __QPdf_UnlockKey($oQPdf, $__sLicenseKey) = 1 Then ConsoleWrite("Library version: " & $oQPdf.LibraryVersion & @CRLF) ConsoleWrite("License Info: " & $oQPdf.LicenseInfo & @CRLF) $oQPdf.LoadFromFile($sFileName, ''); $iPrintOptions = $oQPdf.PrintOptions(0, 0, "Printing Sample 1") $oQPdf.PrintDocument($oQPdf.GetDefaultPrinterName(), 1, 1, $iPrintOptions); $iPrintOptions = $oQPdf.PrintOptions(0, 0, "Printing Sample 2") $oQPdf.PrintDocument($oQPdf.GetDefaultPrinterName(), 1, 1, $iPrintOptions); EndIf EndFunc ;==>_QPdf_Example_PrintDefault EDIT: First time installing Debenu Quick PDF Library: In order to download the current version of the UDF, download the attached file: QuickPDF.au3.Download.html QuickPDF.au3.Download.html
-
I am glad to share with you a quick script I assembled from my older efforts and with drag&drop interface credits to @Trong, to join two or more PDF files together, for a particular environment where other free/open/commercial solutions are prohibited, btw I use Ghostscript under AGPL (link) for the joining job. You can drag and drop files, or browse them, and have a final PDF sum of all the PDF (pages...) you added. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Icone\Full ico\documentsorcopy_V2.ico #AutoIt3Wrapper_UseUpx=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;(C)NSC ; PDFjoint ; nscPDFjoin ; an utility to join multiple pdf using ghostscript, sanitizing the names. ; (c) 2016-23 NSC ; V1.11 march 2020 added fileinstall of the ghostscript ; V1.2 updated chooseFileFolder and updated ghostscript. ; V2.0 complete rewrite with new system to select files ; based on drag and drop script by user Trong in AutoIt Forum: ; https://www.autoitscript.com/forum/topic/209558-gui-example-dragging-and-dropping-folderfiles-into-the-gui/ ; V.2.1 added PDF pages extraction, output name "sanification" removing spacese and dots ; V.2.15 draggable order of files #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPIEx.au3> #include <WinAPIMisc.au3> #include <WinAPIInternals.au3> #include <WinAPISysWin.au3> #include <WinAPIShPath.au3> #include <TrayConstants.au3> #include <Array.au3> #include <File.au3> #include <GuiListView.au3> #include <GUIListViewEx.au3> If Not FileExists("C:\autoit\PDFjoint\gswin64c.exe") Then MsgBox(64, "PDFjoint - Components install", "inserting gswin64c.exe in c:\autoit\PDFjoint", 3) DirCreate("c:\autoit\PDFjoint") FileInstall("c:\NSC_test\resources\PDFJoint\gswin64c.exe", "c:\autoit\PDFjoint\gswin64c.exe", 1) FileInstall("c:\NSC_test\resources\PDFJoint\gsdll64.dll", "c:\autoit\PDFjoint\gsdll64.dll", 1) FileInstall("c:\NSC_test\resources\PDFJoint\gsdll64.lib", "c:\autoit\PDFjoint\gsdll64.lib", 1) EndIf Global $destfolder = "C:\autoit\PDFjoint\PDF_United" If Not FileExists($destfolder) Then DirCreate($destfolder) Global $ver = "V.2.15", $LWid_PDF, $LW_PDF, $aLW_PDF, $aPDF Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declaration Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. Global $trayShow = TrayCreateItem("Show UI") TrayCreateItem("") ; Create a separator line. Global $trayExit = TrayCreateItem("Exit") TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. Global Const $sGUI_Show_Title = 1 Global Const $sAppName = "-> PDF Joint ===#'" & " " & $ver & " NSC" Global Const $sLabel_Title = "Drag and drop files and folders HERE !" Global Const $sLabel_Task = "Or click the button to browse." Global Const $sLabel_Status = "READY !" #Region ### START GUI section ### Global $hGUI If $sGUI_Show_Title Then $hGUI = GUICreate($sAppName, 600, 500, 20, 20, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) Else $hGUI = GUICreate($sAppName, 600, 500, 20, 20, BitOR($WS_POPUP, $WS_BORDER), BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) EndIf GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idLabel_BG = GUICtrlCreateLabel("", 66, 0, 400, 81, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idIcon = GUICtrlCreateIcon(@WindowsDir & "\explorer.exe", -19, 1, 8, 64, 64, BitOR($GUI_SS_DEFAULT_ICON, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetTip(-1, "Set/UnSet Windows on TOP") Global $idLabel_Titles = GUICtrlCreateLabel($sLabel_Title, 69, 10, 396, 17, $SS_CENTERIMAGE, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idLabel_Task = GUICtrlCreateLabel($sLabel_Task, 69, 34, 396, 17, $SS_CENTERIMAGE, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idLabel_Status = GUICtrlCreateLabel($sLabel_Status, 69, 58, 396, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE), $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idButton_BrowseFiles = GUICtrlCreateButton("Browse &files", 472, 8, 99, 33, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idButton_About = GUICtrlCreateButton("(c)", 579, 34, 17, 17, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetTip(-1, "Show About") Global $idProgress_Total = GUICtrlCreateProgress(1, 1, 596, 4) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $idProgress_Current = GUICtrlCreateProgress(1, 75, 596, 4) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) LW_PDF_create() GUICtrlCreateGroup("Mode:", 10, 385, 300, 40) Global $radioJoin = GUICtrlCreateRadio("Join PDFs", 15, 400, 100, 20) GUICtrlSetState($radioJoin, $GUI_CHECKED) GUICtrlSetTip(-1, "mode: two or more PDF joined together") Global $radioextr = GUICtrlCreateRadio("Extract PDF", 160, 400, 100, 20) GUICtrlSetTip(-1, "mode: extract a new pdf from page x to page y, same extraction also for multiple PDFs") Global $idButton_Join = GUICtrlCreateButton("Work !", 10, 430, 50, 50, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 10, 800, 80, "consolas") GUICtrlSetTip(-1, "Join PDFs !") Global $idButton_Join_on_Desktop = GUICtrlCreateButton("Work to Desktop", 65, 435, 100, 40, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 7, 200, 50, "consolas") GUICtrlSetTip(-1, "Join PDFs ON DESKTOP") Global $idButton_openfolder = GUICtrlCreateButton("Output Folder", 250, 430, 100, 50, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 10, 800, 80, "consolas") GUICtrlSetTip(-1, "Open folder with all United PDFs") Global $idButton_Clear = GUICtrlCreateButton("Clear List", 490, 430, 100, 50, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1, 10, 800, 80, "consolas") GUICtrlSetTip(-1, "Clean the current list of PDF files") #EndRegion ### START GUI section ### HotKeySet('^5', '_GUI_SetOnTop') Global $GuiOnTop = 0, $onWorking = 0 WinSetTrans($hGUI, "", 91) _GUI_OnProgress() _GUI_SHOW() _GUI_OnStandby() WinSetTrans($hGUI, "", 230) ; Allow drag and drop when run as! _WinAPI_ChangeWindowMessageFilterEx($hGUI, $WM_DROPFILES, $MSGFLT_ALLOW) ; $WM_DROPFILES = 0x0233 _WinAPI_ChangeWindowMessageFilterEx($hGUI, $WM_COPYDATA, $MSGFLT_ALLOW) ; $WM_COPYDATA = 0x004A - $MSGFLT_ALLOW = 1 _WinAPI_ChangeWindowMessageFilterEx($hGUI, $WM_COPYGLOBALDATA, $MSGFLT_ALLOW) ; $WM_COPYGLOBALDATA = 0x0049 AdlibRegister("_GUI_ResetStatus", 5000) AdlibRegister("_GUI_SwitchMsg", 50) AdlibRegister("_TRAY_SwitchMsg", 50) Global $__aDropFiles, $sPercent, $guiMsg, $trayMsg GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES") Global $aCmdLineRaw = StringReplace($CmdLineRaw, '/ErrorStdOut "' & @ScriptFullPath & '"', "") ;ConsoleWrite($aCmdLineRaw & @CRLF) Global $aCmdLine = _WinAPI_CommandLineToArgv($aCmdLineRaw) If IsArray($aCmdLine) And $aCmdLine[0] > 0 Then _GUI_OnProgress() For $i = 1 To $aCmdLine[0] _Main_Processing($aCmdLine[$i], $i, $aCmdLine[0]) Next _GUI_OnStandby() GUICtrlSetData($idLabel_Status, "Everything is done!") Sleep(3000) ; Pause 4s Exit Else While 1 ;_GUI_SwitchMsg() Switch $guiMsg Case $idButton_BrowseFiles _GUI_OnProgress() ; Display an open dialog to select files. Local $zListFileIN, $zFileIN = FileOpenDialog("Select Files", @WorkingDir, "All File (*)", $FD_FILEMUSTEXIST + $FD_MULTISELECT, "", $hGUI) ;1+4 If Not @error Then If StringInStr($zFileIN, "|") Then $zListFileIN = StringSplit($zFileIN, "|") If IsArray($zListFileIN) Then For $i = 2 To $zListFileIN[0] _Main_Processing($zListFileIN[$i], $i - 1, $zListFileIN[0] - 1) Next EndIf Else _Main_Processing($zFileIN, 1, 1) EndIf EndIf _GUI_OnStandby() Case $idButton_Join _GUI_OnProgress() Selector() LW_PDF_reset() $aPDF = "" If Not WinExists("PDF_United") Then Run("explorer.exe " & $destfolder) _GUI_OnStandby() Case $idButton_Join_on_Desktop _GUI_OnProgress() $destfolder = @DesktopDir Selector() LW_PDF_reset() $aPDF = "" $destfolder = "C:\autoit\PDFjoint\PDF_United" _GUI_OnStandby() Case $idButton_Clear _GUI_OnProgress() LW_PDF_reset() $aPDF = "" _GUI_OnStandby() Case $idButton_openfolder _GUI_OnProgress() Run("explorer.exe " & $destfolder) _GUI_OnStandby() Case $GUI_EVENT_DROPPED _GUI_OnProgress() If $__aDropFiles[0] > 0 Then For $i = 1 To $__aDropFiles[0] _Main_Processing($__aDropFiles[$i], $i, $__aDropFiles[0]) Next EndIf _GUI_OnStandby() EndSwitch ;_TRAY_SwitchMsg() WEnd EndIf ; * -----:| Func _Main_Processing($sFilePath, $nCurrent = 0, $nTotal = 0) ;_GUI_SwitchMsg() ;_TRAY_SwitchMsg() $sPercent = Round(($nCurrent / $nTotal) * 100, 2) GUICtrlSetData($idProgress_Total, $sPercent) ;ConsoleWrite("- Percent: " & $sPercent & " %" & @CRLF) GUICtrlSetData($idProgress_Current, 0) GUICtrlSetData($idLabel_Titles, "Processing " & $nCurrent & "/" & $nTotal & " folder/files ! ") Local $sDrive, $sParentDir, $sCurrentDir, $sFileNameNoExt, $sExtension, $sFileName, $sPathParentDir, $sPathCurrentDir, $sPathFileNameNoExt Local $aPathSplit = _SplitPath($sFilePath, $sDrive, $sParentDir, $sCurrentDir, $sFileNameNoExt, $sExtension, $sFileName, $sPathParentDir, $sPathCurrentDir, $sPathFileNameNoExt) ;Local $sCurrentDirPath= $sDrive&$sCurrentDir;StringRegExpReplace($aPathSplit, '\\[^\\]*$', '') ;Local $sCurrentDirName =StringRegExpReplace(_PathRemoveBackslash($sCurrentDirPath), '.*\\', '') #cs ConsoleWrite(";~ - [1] Drive: " & $sDrive & @CRLF) ConsoleWrite(";~ - [2] ParentDir: " & $sParentDir & @CRLF) ConsoleWrite(";~ - [3] CurrentDir: " & $sCurrentDir & @CRLF) ConsoleWrite(";~ - [4] FileName NoExt: " & $sFileNameNoExt & @CRLF) ConsoleWrite(";~ - [5] Extension: " & $sExtension & @CRLF) ConsoleWrite(";~ - [6] FileName: " & $sFileName & @CRLF) ConsoleWrite(";~ - [7] PathParentDir: " & $sPathParentDir & @CRLF) ConsoleWrite(";~ - [8] PathCurrentDir: " & $sPathCurrentDir & @CRLF) ConsoleWrite(";~ - [9] PathFileName NoExt: " & $sPathFileNameNoExt & @CRLF) ConsoleWrite("- Processing (" & $nCurrent & "/" & $nTotal & "): " & $sFilePath & @CRLF) #ce If _IsFile($sFilePath) Then ; ConsoleWrite("- Processing file: " & $sFileName & @CRLF) GUICtrlSetData($idLabel_Task, "Currently File: " & $sFileName) ; Your file handler is here! If Not IsArray($aPDF) Then Global $aPDF[1][3] $aPDF[0][0] = $aPDF[0][0] + 1 _ArrayAdd($aPDF, $sDrive & $sParentDir & $sCurrentDir & "|" & $sFileNameNoExt & "|" & $sExtension) LW_PDF_reset() LW_PDF_populate() Else If ($sParentDir == "\" And $sCurrentDir == "") Then ; Is Root Drive ; Your drive handler is here! ; ConsoleWrite("- Processing drive: " & $sDrive & @CRLF) GUICtrlSetData($idLabel_Task, "Currently Drive: " & $sDrive) Else ; Your directory handler is here! ; ConsoleWrite("- Processing directory: " & _PathRemove_Backslash($sPathCurrentDir) & @CRLF) GUICtrlSetData($idLabel_Task, "Currently Folder: " & _PathRemove_Backslash($sCurrentDir)) EndIf EndIf ; Code section for GUI testing only GUICtrlSetData($idProgress_Current, 40) Sleep(100) ; test gui GUICtrlSetData($idProgress_Current, 60) Sleep(100) ; test gui GUICtrlSetData($idProgress_Current, 80) Sleep(100) ; test gui GUICtrlSetData($idProgress_Current, 100) GUICtrlSetData($idLabel_Status, "Everything is done!") Sleep(600) ; test gui ; End code test GUI EndFunc ;==>_Main_Processing Func _Exit() If $onWorking Then Local $IdOfButtonPressed = MsgBox($MB_ICONQUESTION + $MB_OKCANCEL + $MB_TOPMOST, "Program is working!", "Are you sure you want to exit the program?" & @CRLF & "Select [OK] to Exit - Select [Cancel] continue script", 10, $hGUI) If ($IdOfButtonPressed = $IDOK) Then Exit Else Exit EndIf EndFunc ;==>_Exit Func _GUI_SwitchMsg() $guiMsg = GUIGetMsg() Switch $guiMsg Case $idButton_About MsgBox(64, $sAppName & " : © NSC 2023 ", $ver & " based on Ghostscript (AGPL version) and on drag and drop script by Ðào Van Trong - Trong.LIVE", Default, $hGUI) ; Case $idButton_Minimizes ; GUISetState(@SW_MINIMIZE, $hGUI) Case $idIcon _GUI_SetOnTop() Case $GUI_EVENT_CLOSE ;, $idButton_Close _Exit() EndSwitch EndFunc ;==>_GUI_SwitchMsg Func _GUI_SetOnTop() _GUI_SHOW() If $GuiOnTop Then $GuiOnTop = 0 GUICtrlSetData($idLabel_Status, "The window is now normal, no longer always showing on top.") Else $GuiOnTop = 1 GUICtrlSetData($idLabel_Status, "Set window to always show on top.") EndIf WinSetOnTop($hGUI, "", $GuiOnTop) EndFunc ;==>_GUI_SetOnTop Func _TRAY_SwitchMsg() $trayMsg = TrayGetMsg() Switch $trayMsg Case $trayShow _GUI_SHOW() Case $trayExit _Exit() EndSwitch EndFunc ;==>_TRAY_SwitchMsg Func _GUI_ResetStatus() ;_GUI_SHOW() If $onWorking Then GUICtrlSetData($idLabel_Status, "Working...") Else GUICtrlSetData($idLabel_Status, $sLabel_Status) EndIf EndFunc ;==>_GUI_ResetStatus Func _GUI_SHOW() _WinAPI_ShowWindow(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_UNLOCK, $hGUI) GUISetState(@SW_ENABLE, $hGUI) GUISetState(@SW_RESTORE, $hGUI) GUISetState(@SW_SHOWNORMAL, $hGUI) WinActivate($hGUI) EndFunc ;==>_GUI_SHOW Func _GUI_OnProgress() $onWorking = 1 GUICtrlSetData($idLabel_Status, "Working...") GUICtrlSetData($idProgress_Total, 0) GUICtrlSetData($idProgress_Current, 0) GUICtrlSetState($idButton_BrowseFiles, $GUI_DISABLE) ; DISABLE GUICtrlSetState($idButton_Join, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idButton_Clear, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idButton_openfolder, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idLabel_BG, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idIcon, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idLabel_Titles, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idLabel_Task, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idLabel_Status, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idButton_BrowseFiles, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idButton_About, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idProgress_Total, $GUI_NODROPACCEPTED) ; NODROPACCEPTED GUICtrlSetState($idProgress_Current, $GUI_NODROPACCEPTED) ; NODROPACCEPTED EndFunc ;==>_GUI_OnProgress Func _GUI_OnStandby() $onWorking = 0 GUICtrlSetData($idLabel_Titles, $sLabel_Title) GUICtrlSetData($idLabel_Task, $sLabel_Task) GUICtrlSetData($idLabel_Status, $sLabel_Status) GUICtrlSetData($idProgress_Total, 100) GUICtrlSetData($idProgress_Current, 100) GUICtrlSetState($idButton_BrowseFiles, $GUI_ENABLE) ; ENABLE GUICtrlSetState($idButton_Join, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idButton_Clear, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idButton_openfolder, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idLabel_BG, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idIcon, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idLabel_Titles, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idLabel_Task, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idLabel_Status, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idButton_BrowseFiles, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idButton_About, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idProgress_Total, $GUI_DROPACCEPTED) ; DROPACCEPTED GUICtrlSetState($idProgress_Current, $GUI_DROPACCEPTED) ; DROPACCEPTED EndFunc ;==>_GUI_OnStandby Func WM_DROPFILES($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $ilParam Switch $iMsg Case $WM_DROPFILES Local $aReturn = _WinAPI_DragQueryFileEx($iwParam) If IsArray($aReturn) Then $__aDropFiles = $aReturn Else Local $aError[1] = [0] $__aDropFiles = $aError EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_DROPFILES ; * -----:| Func _IsFile($sPath) If (Not FileExists($sPath)) Then Return SetError(-1, 0, 0) If StringInStr(FileGetAttrib($sPath), 'D') <> 0 Then Return SetError(0, 0, 0) Else Return SetError(0, 0, 1) EndIf EndFunc ;==>_IsFile #Region listview Func LW_PDF_create() ;crea listview Eventi $LW_PDF = GUICtrlCreateListView("PDF files path|PDF files|ext ", 2, 82, 596, 300, BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($LW_PDF, $LVS_EX_FULLROWSELECT) _GUICtrlListView_SetColumnWidth($LW_PDF, 0, 300) _GUICtrlListView_SetColumnWidth($LW_PDF, 1, 250) _GUICtrlListView_SetColumnWidth($LW_PDF, 2, 40) GUICtrlSetFont($LW_PDF, 9, 800, 0, "verdana") GUICtrlSetResizing($LW_PDF, 102) $LWid_PDF = _GUIListViewEx_Init($LW_PDF, "", 0, Default, False, 33) _GUIListViewEx_MsgRegister() ; If you do not do this they UDF will not work at all <<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUISetState() EndFunc ;==>LW_PDF_create Func LW_PDF_reset() ; cancella e ricrea If IsArray($aLW_PDF) Then If $aLW_PDF[0][0] <> 0 Then _GUIListViewEx_DeleteSpec($LWid_PDF, LW_RangeGenerator($aLW_PDF[0][0])) EndIf EndIf EndFunc ;==>LW_PDF_reset Func LW_PDF_populate() _GUIListViewEx_BlockReDraw($LWid_PDF, True) ; perla pearl anti flickering ( use with same instruction with FALSE to close, look down...) Local $visibileRows = 0 Local $imeno1 For $i = 1 To UBound($aPDF) - 1 $imeno1 = $i - 1 Local $list_fields = _ArrayToString($aPDF, "|", $i, $i) ; possible pearl _GUIListViewEx_InsertSpec($LWid_PDF, $imeno1, $list_fields, False, False) If @error Then MsgBox($MB_OK, @error, "_GUIListViewEx_InsertSpec(" & $i & ") Failed -- Aborting") Exit EndIf $visibileRows += 1 Next _GUICtrlListView_EnsureVisible($LW_PDF, 0) ; _GUIListViewEx_BlockReDraw($LWid_PDF, False) $aLW_PDF = _GUIListViewEx_ReadToArray($LW_PDF, 1) EndFunc ;==>LW_PDF_populate Func LW_RangeGenerator($range) Local $text For $i = 0 To $range - 1 If $i = 0 Then $text = $i Else $text = $text & ";" & $i EndIf Next Return $text EndFunc ;==>LW_RangeGenerator #EndRegion listview Func _SplitPath($sFilePath, ByRef $sDrive, ByRef $sParentDir, ByRef $sCurrentDir, ByRef $sFileNameNoExt, ByRef $sExtension, ByRef $sFileName, ByRef $sPathParentDir, ByRef $sPathCurrentDir, ByRef $sPathFileNameNoExt) $sFilePath = _PathFix($sFilePath) _PathSplit_Ex($sFilePath, $sDrive, $sParentDir, $sCurrentDir, $sFileNameNoExt, $sExtension) $sFileName = $sFileNameNoExt & $sExtension $sPathParentDir = $sDrive & $sParentDir $sPathCurrentDir = $sDrive & $sParentDir & $sCurrentDir $sPathFileNameNoExt = $sDrive & $sParentDir & $sCurrentDir & $sFileNameNoExt Local $aSplitPath[10] = [$sDrive, $sParentDir, $sCurrentDir, $sFileNameNoExt, $sExtension, $sFileName, $sPathParentDir, $sPathCurrentDir, $sPathFileNameNoExt] Return $aSplitPath EndFunc ;==>_SplitPath ; * -----:| Func _PathSplit_Ex($sFilePath, ByRef $sDrive, ByRef $sParentDir, ByRef $sCurrentDir, ByRef $sFileNameNoExt, ByRef $sExtension) $sFilePath = _PathFix($sFilePath) $sFilePath = StringRegExp($sFilePath & " ", "^((?:\\\\\?\\)*(\\\\[^\?\/\\]+|[A-Za-z]:)?(.*?[\/\\]+)?([^\/\\]*[\/\\])?[\/\\]*((?:[^\.\/\\]|(?(?=\.[^\/\\]*\.)\.))*)?([^\/\\]*))$", 1) $sDrive = (StringStripWS($sFilePath[1], 8) == "") ? "" : $sFilePath[1] $sFilePath[2] = StringRegExpReplace($sFilePath[2], "[\/\\]+\h*", "\" & StringLeft($sFilePath[2], 1)) $sParentDir = (StringStripWS($sFilePath[2], 8) == "") ? "" : $sFilePath[2] $sCurrentDir = (StringStripWS($sFilePath[3], 8) == "") ? "" : $sFilePath[3] $sFileNameNoExt = (StringStripWS($sFilePath[4], 8) == "") ? "" : $sFilePath[4] $sExtension = (StringStripWS($sFilePath[5], 8) == "") ? "" : StringStripWS($sFilePath[5], 3) Return $sFilePath EndFunc ;==>_PathSplit_Ex ; * -----:| Func _PathFix($sFilePath) $sFilePath = StringStripWS($sFilePath, 3) $sFilePath = StringReplace($sFilePath, "/", "\") While StringInStr($sFilePath, " \") $sFilePath = StringReplace($sFilePath, " /", "\") WEnd While StringInStr($sFilePath, "\ ") $sFilePath = StringReplace($sFilePath, "/ ", "\") WEnd If (FileExists($sFilePath) And StringInStr(FileGetAttrib($sFilePath), 'D')) Then $sFilePath = _PathRemove_Backslash($sFilePath) & "\" EndIf Return $sFilePath EndFunc ;==>_PathFix ; * -----:| Func _PathRemove_Backslash($sPath) If StringRight($sPath, 1) == '\' Then $sPath = StringTrimRight($sPath, 1) EndIf Return $sPath EndFunc ;==>_PathRemove_Backslash ; * -----:| Func __WinAPI_GetLastError(Const $_iCallerError = @error, Const $_iCallerExtended = @extended) Local $aCall = DllCall("kernel32.dll", "dword", "GetLastError") Return SetError($_iCallerError, $_iCallerExtended, $aCall[0]) EndFunc ;==>__WinAPI_GetLastError Func __WinAPI_CreateFileEx($sFilePath, $iCreation, $iAccess = 0, $iShare = 0, $iFlagsAndAttributes = 0, $tSecurity = 0, $hTemplate = 0) Local $aCall = DllCall('kernel32.dll', 'handle', 'CreateFileW', 'wstr', $sFilePath, 'dword', $iAccess, 'dword', $iShare, 'struct*', $tSecurity, 'dword', $iCreation, 'dword', $iFlagsAndAttributes, 'handle', $hTemplate) If @error Then Return SetError(@error, @extended, 0) If $aCall[0] = Ptr(-1) Then Return SetError(10, __WinAPI_GetLastError(), 0) Return $aCall[0] EndFunc ;==>__WinAPI_CreateFileEx Func __WinAPI_CloseHandle($hObject) Local $aCall = DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hObject) If @error Then Return SetError(@error, @extended, False) Return $aCall[0] EndFunc ;==>__WinAPI_CloseHandle ; * -----:| #Region PDF JOIner Func Selector() $aLW_PDF = _GUIListViewEx_ReadToArray($LW_PDF, 1) $aPDF = $aLW_PDF ;V2.15 If GUICtrlRead($radioJoin) = $GUI_CHECKED Then PREJoiner() Else PREExtractor() EndIf EndFunc ;==>Selector Func PREJoiner() Local $uno, $due, $tre, $nomefinale If IsArray($aPDF) Then For $i = 1 To $aPDF[0][0] If $i = 1 Then ; primo giro chiedo il nome del pdf finale $uno = filenamesanitizer($aPDF[$i][0] & $aPDF[$i][1] & $aPDF[$i][2]) $nomefinale = InputBox("PDFjoint - Joined PDF name ", "Write down filename without '.pdf' ", "UnitedPDF" & @MSEC) $nomefinale = StringStripCR($nomefinale) $nomefinale = StringStripWS($nomefinale, 8) $nomefinale = StringReplace($nomefinale, ".", "") $nomefinale = $nomefinale & ".pdf" EndIf If $i = 2 Then $due = filenamesanitizer($aPDF[$i][0] & $aPDF[$i][1] & $aPDF[$i][2]) $tre = $destfolder & "\PDFjoint_work" & $i & ".pdf" joiner($uno, $due, $tre) EndIf If $i > 2 Then $uno = $tre $due = filenamesanitizer($aPDF[$i][0] & $aPDF[$i][1] & $aPDF[$i][2]) $tre = $destfolder & "\PDFjoint_work" & $i & ".pdf" joiner($uno, $due, $tre) EndIf Next FileMove($tre, $destfolder & "\" & $nomefinale) If FileExists($destfolder & "\PDFjoint_work*.pdf") Then FileDelete($destfolder & "\PDFjoint_work*.pdf") EndIf MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "PDFjoint", "Created new PDF " & @CRLF & @CRLF & $destfolder & "\" & $nomefinale, 2) Else MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "PDF Joint", "No files selected to Join !") EndIf EndFunc ;==>PREJoiner Func joiner($uno, $due, $tre) Local $cmd1 = "C:\autoit\PDFjoint\gswin64c.exe" Local $cmd2 = '-dBATCH -dNOPAUSE -dQUIET -sDEVICE=pdfwrite -sOutputFile=' & '"' & $tre & '"' & ' ' & '"' & $uno & '"' & ' ' & $due ShellExecuteWait($cmd1, $cmd2, "", "open", @SW_HIDE) EndFunc ;==>joiner Func PREExtractor() Local $prange = InputBox("PDFjoint - PDF Pages to extract ", "Write from page to page (example 2,3)", ",") Local $arange = _ArrayFromString($prange, ",") If IsArray($aPDF) Then Local $nomeoutfile, $nomeinfile For $i = 1 To $aPDF[0][0] $nomeinfile = filenamesanitizer($aPDF[$i][0] & $aPDF[$i][1] & $aPDF[$i][2]) $nomeoutfile = $destfolder & "\" & onlynamesanitizer($aPDF[$i][1]) & "_pages_" & $arange[0] & "-" & $arange[1] & $aPDF[$i][2] Extractor($nomeinfile, $nomeoutfile, $arange[0], $arange[1]) Next MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "PDFjoint", "extracted new PDF(s) in " & @CRLF & @CRLF & $destfolder & "\", 2) Else MsgBox($MB_SYSTEMMODAL + $MB_ICONINFORMATION, "PDFJoint", "No files selected to perform extraction !") EndIf EndFunc ;==>PREExtractor Func Extractor($in, $out, $dapag, $apag) Local $cmd1 = "C:\autoit\PDFjoint\gswin64c.exe" Local $cmd2 = '-sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dFirstPage=' & '"' & $dapag & '"' & ' -dLastPage=' & '"' & $apag & '"' & ' -sOutputFile=' & $out & ' ' & $in ShellExecuteWait($cmd1, $cmd2, "", "open", @SW_HIDE) EndFunc ;==>Extractor Func filenamesanitizer($filepathname) ; accept a complete path + filename and sanitize the name plus move in a temp folder Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" Local $aPathSplit = _PathSplit($filepathname, $sDrive, $sDir, $sFileName, $sExtension) Local $nomefile = StringStripCR($aPathSplit[3]) $nomefile = StringStripWS($nomefile, 8) $nomefile = StringReplace($nomefile, ".", "") $nomefile = "c:\temp\" & $nomefile & $aPathSplit[4] If Not FileExists("c:\temp") Then DirCreate("c:\temp") FileCopy($filepathname, $nomefile, 1) Return $nomefile EndFunc ;==>filenamesanitizer Func onlynamesanitizer($onlyname) $onlyname = StringStripWS($onlyname, 8) $onlyname = StringReplace($onlyname, ".", "") Return $onlyname EndFunc ;==>onlynamesanitizer #EndRegion PDF JOIner V.2.1 implemented PDF pages extraction, in this case if you add multiple files the page extraction will be performed on all the pdf files. V.2.15 you can now drag&drop reorder the file list and have PDF joined in the final order. to do : some checks about the original documents (ex. if you have a pdf with 3 pages and you want to extract page 4...) documentsorcopy_V2.ico
-
Hello How can I export a sheet to pdf using the OOoCalc.au3 UDF? Thank you for any hints or possibly other solutions / functions.
-
This UDF is because I'm tired of trying to use UI Automation and Send to automate Adobe Acrobat. I often need to read the contents of PDFs and Acrobat is not easy to work with as a window. The functions are based on the API Reference from Adobe located here. Acrobat Pro is required for all functions. It's very beta right now, but it still seems to work. Currently, the functions are based around page level manipulation of PDF documents: re-arranging, swapping, deleting, and moving pages as this is what I use the most. Please feel free to request/suggest features!
-
Today, in the end as well, worked out using the Acrobat Reader ActiveX COM Object "AcroPDF.PDF.1" #include-once #include <Constants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <MenuConstants.au3> #include <WinAPI.au3> ;~ Thanks to BrewManNH ;~ http://www.autoitscript.com/forum/topic/134878-guiregistermsg-replacement-for-guictrlsetonevent-and-guigetmsg/ ;~ Thanks to mikell ;~ http://www.autoitscript.com/forum/topic/161985-how-to-close-gui-with-guiregistermsg/ ; Install a custom error handler Global $oMyError = ObjEvent("AutoIt.Error", "_ComErrFunc") Global $__hExampleGUI Global $__idOPEN Global $_fExit Global $__hACROBAT_GUI = '' Global $__idACROBAT_GUI_CTRL_AX = '' Global $__oACROBAT_READER = '' #include <GUIConstantsEx.au3> ;~ GUIRegisterMsg($WM_ERASEBKGND, "_WM_EXTRACTOR") ;~ GUIRegisterMsg($WM_PAINT, "_WM_EXTRACTOR") ;~ GUIRegisterMsg($WM_ACTIVATE, "_WM_EXTRACTOR") ;~ GUIRegisterMsg($WM_CAPTURECHANGED, "_WM_EXTRACTOR") ;~ GUIRegisterMsg($WM_DEVICECHANGE, "_WM_EXTRACTOR") GUIRegisterMsg($WM_EXITSIZEMOVE, "_WM_EXTRACTOR") GUIRegisterMsg($WM_COMMAND, "_WM_EXTRACTOR") GUIRegisterMsg($WM_SYSCOMMAND, "_WM_EXTRACTOR") GUIRegisterMsg($WM_HSCROLL, "_WM_EXTRACTOR") _ExampleProgram_Gui() While 1 Sleep(10) If $_fExit Then _ACROBAT_GUI_DELETE() DeleteGui() Exit EndIf WEnd Func DeleteGui() GUIDelete($__hExampleGUI) EndFunc ;==>DeleteGui Func _ExampleProgram_Gui() ; Create a GUI with various controls. $__hExampleGUI = GUICreate("Example") $__idOPEN = GUICtrlCreateButton("&Open", 310, 370, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $__hExampleGUI) EndFunc ;==>_ExampleProgram_Gui #Region ACROBAT FUNCTION Func _AcrobatInit() $__oACROBAT_READER = ObjCreate("AcroPDF.PDF.1"); Return $__oACROBAT_READER.GetVersions EndFunc ;==>_AcrobatInit Func _Acrobat_Events(ByRef $aMSG) If $aMSG[1] = $__hACROBAT_GUI Then Switch $aMSG[0] Case $GUI_EVENT_CLOSE _ACROBAT_GUI_DELETE() EndSwitch EndIf EndFunc ;==>_Acrobat_Events Func _ACROBAT_Destroy() $__oACROBAT_READER = "" ;~ MsgBox(1,'test','destroyed') EndFunc ;==>_ACROBAT_Destroy Func _AcrobatShow($sFile, $sTitle = "PDF ", $iLeft = 50, $iTop = 0, $iWidth = 1000, $iHeight = 700) If FileExists($sFile) Then _AcrobatInit() ; Set option $__oACROBAT_READER.src = $sFile $__oACROBAT_READER.SetLayoutMode(4) $__oACROBAT_READER.SetPageMode(1) $__oACROBAT_READER.SetShowToolbar(0) $__oACROBAT_READER.SetView(1) ; Create GUI $__hACROBAT_GUI = GUICreate($sTitle, $iWidth, $iHeight, $iLeft, $iTop, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MAXIMIZEBOX)) $__idACROBAT_GUI_CTRL_AX = GUICtrlCreateObj($__oACROBAT_READER, 5, 5, $iWidth - 20, $iHeight - 10) GUICtrlSetStyle($__idACROBAT_GUI_CTRL_AX, $WS_VISIBLE) GUISetState() EndIf EndFunc ;==>_AcrobatShow Func _ACROBAT_Refresh() If IsObj($__oACROBAT_READER) Then Local $hPreviouslyGui = GUISwitch($__hACROBAT_GUI) GUISetState(@SW_LOCK) Local $iGUI_PDFWidth = WinGetPos($__hACROBAT_GUI)[2] - 20 Local $iGUI_PDFHeight = WinGetPos($__hACROBAT_GUI)[3] - 40 Local $sFile = $__oACROBAT_READER.src ; this below line do not works with Acro Reader ; Local $iCurrentPage = $__oACROBAT_READER.GetNumber Local $iCurrentPage = 0 _ACROBAT_Destroy() GUICtrlDelete($__idACROBAT_GUI_CTRL_AX) _AcrobatInit() $__idACROBAT_GUI_CTRL_AX = GUICtrlCreateObj($__oACROBAT_READER, 5, 5, $iGUI_PDFWidth, $iGUI_PDFHeight) $__oACROBAT_READER.src = $sFile ;~ $__oACROBAT_READER.SetCurrentPage($iCurrentPage) GUISetState(@SW_UNLOCK) GUISwitch($hPreviouslyGui) EndIf EndFunc ;==>_ACROBAT_Refresh Func _ACROBAT_GUI_DELETE() _ACROBAT_Destroy() if IsHWnd($__hACROBAT_GUI) then GUIDelete($__hACROBAT_GUI) EndFunc ;==>_ACROBAT_GUI_DELETE #EndRegion ACROBAT FUNCTION #Region MSG and ERROR HANDLER Func _WM_EXTRACTOR($hWnd, $iMsg, $wParam, $lParam) ;~ ConsoleWrite('! $hWnd = ' & $hWnd & ' $iMsg = ' & $iMsg & '('&HEX($iMsg)&')'& ' $wParam = ' & $wParam & ' $lParam = ' & $lParam & @CRLF) If $hWnd = ControlGetHandle($__hACROBAT_GUI, '', $__idACROBAT_GUI_CTRL_AX) Then ConsoleWrite('! -------------- $hWnd = ' & $hWnd & ' $iMsg = ' & $iMsg & '(' & Hex($iMsg) & ')' & ' $wParam = ' & $wParam & ' $lParam = ' & $lParam & @CRLF) EndIf If $hWnd = $__hACROBAT_GUI Then Switch $iMsg Case $WM_COMMAND #cs Case $WM_ACTIVATE Local $test = BitAND($wParam, 0x00000004) if $test <> 0 then MsgBox(1,'$WM_ACTIVATE','test') _ACROBAT_Refresh() EndIf Case $WM_ERASEBKGND WinGetHandle("[ACTIVE]") if $__hACROBAT_GUI <> _WinAPI_GetWindow ( $__hACROBAT_GUI, $GW_HWNDPREV ) then ConsoleWrite('! Case $WM_ERASEBKGND' & @CRLF) _ACROBAT_Refresh() _WinAPI_RedrawWindow($__hACROBAT_GUI,0,0,$RDW_NOERASE) EndIf Case $WM_PAINT _WinAPI_RedrawWindow($__hACROBAT_GUI,0,0,$RDW_NOERASE) Case $WM_CAPTURECHANGED _ACROBAT_Refresh() Case $WM_DEVICECHANGE _ACROBAT_Refresh() #ce Case $WM_EXITSIZEMOVE _ACROBAT_Refresh() Case $WM_SYSCOMMAND ;~ Local $test = BitAND($wParam, 0xFFF0) Local $test = BitAND($wParam, 0x0000FFFF) Switch $test Case $SC_CLOSE _ACROBAT_GUI_DELETE() Case $SC_CONTEXTHELP Case $SC_DEFAULT Case $SC_HOTKEY Case $SC_HSCROLL Case $SC_KEYMENU Case $SC_MAXIMIZE _ACROBAT_Refresh() Case $SC_MINIMIZE Case $SC_MONITORPOWER Case $SC_MOUSEMENU Case $SC_MOVE ;~ _ACROBAT_Refresh() Case $SC_NEXTWINDOW ;~ _ACROBAT_Refresh() Case $SC_PREVWINDOW ;~ _ACROBAT_Refresh() Case $SC_RESTORE _ACROBAT_Refresh() Case $SC_SCREENSAVE Case $SC_SIZE Case $SC_TASKLIST Case $SC_VSCROLL EndSwitch EndSwitch EndIf If $hWnd = $__hExampleGUI Then Switch $iMsg Case $WM_COMMAND Local $nID = BitAND($wParam, 0x0000FFFF) Local $hCtrl = $lParam Switch $nID Case $__idOPEN if not IsObj($__oACROBAT_READER) then _AcrobatShow(FileOpenDialog("Choose PDF", "C:\Temp", "PDF Files(*.pdf)", 3)) ; put your own start folder here) EndIf EndSwitch Case $WM_SYSCOMMAND Local $test = BitAND($wParam, 0xFFF0) Switch $test Case $SC_CLOSE $_fExit = True Case $SC_CONTEXTHELP Case $SC_DEFAULT Case $SC_HOTKEY Case $SC_HSCROLL Case $SC_KEYMENU Case $SC_MAXIMIZE Case $SC_MINIMIZE Case $SC_MONITORPOWER Case $SC_MOUSEMENU Case $SC_MOVE Case $SC_NEXTWINDOW Case $SC_PREVWINDOW Case $SC_RESTORE Case $SC_SCREENSAVE Case $SC_SIZE Case $SC_TASKLIST Case $SC_VSCROLL EndSwitch EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_WM_EXTRACTOR Func _ComErrFunc() Local $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "AutoItCOM Test", _ "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) EndFunc ;==>_ComErrFunc #EndRegion MSG and ERROR HANDLER Any comments are welcome. Cheers mLipok
- 20 replies
-
- acrobat reader
-
(and 3 more)
Tagged with:
-
I was allways wondering How to get reference to AcrobatReader object and after all to the PDF file embeded in IE. Today I was here: http://www.vitoplantamura.com/index.aspx?page=axvncviewer there is such a interesting html: When I analyze this then I start to wonder about this line: EDIT: above fraction was only an introduction, describing where it came my question. And now then the question arise : How I can use document.all to get the refrence to specified AxObject in this Case I mean to AcrobatReader opened in IE ? EDIT: of course I mean a case when I have opened document in IE.
-
Hello, still learning and trying to understand AutoIT but having problem in filling my PDF file. So my code looks like similar to this: Global $1 = "text text 44444444" Global $2 = "texting2 texting2" Global $3 = "newtext3 next3" ShellExecute ("C:\Users\XXX\Desktop\myPDF.pdf") WinWaitActive("MyPDF.pdf - Adobe Acrobat Reader DC") Send ("{TAB}") ClipPut($1) Send ("^v") Send ("{TAB 3}") ClipPut($2) Send("^v") Send ("{TAB}") ClipPut($3) Send("^v") So its fill my PDF form, the first field looks good, the code add the text text 4444, then second should be $2 with texting2 texting2 but for some reason the code uses for second and third field after TAB only variable $3. So, I receive in $2 and $3 for some reason same newtext3 next3 in both, why its skipping the variable $2? Maybe there also much better solution for instant text? Because Send writes with delay by letters which I don't like. Thanks!
-
Hello! i wrote this function as alternative to using the Com Object or Commandline version of this project, discussed also earlyer on this forum. Project site - http://ebstudio.info/home/xdoc2txt.html Advantage of this implementation is that you do not need to register Com dll, using regsvr32. But you still need the project Dll (xd2txlib.dll). Enjoy! ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ExtractText ; Description ...: Extracts text from advanced documment formats (Doc, Docx, ODT, XLS, ...) ; Syntax ........: _ExtractText($sFilename[, $bProperties = False[, $hDll = 0]]) ; Parameters ....: $sFilename - a string value. ; $bProperties - [optional] a boolean value. Default is False. If True, documment properties will be returned instead of the text. ; $hDll - [optional] a handle value. Default is 0. Optional handle to previously opened xd2txlib.dll. By default the xd2txlib.dll (Expected in @scriptdir) will be opened and closed during the function call. ; Return value .: String, containing the text or documment properties or empty string and Error as follows: ;1 - The file does not exists. ;2 - Error during opening xd2txlib.dll. ;3 - No text returned. ; Author ........: Fenzik ; Modified ......: ; Remarks .......: Project site - http://ebstudio.info/home/xdoc2txt.html ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _ExtractText($sFilename, $bProperties = False, $hDll = 0) If Not FileExists($sFilename) Then Return SetError(1, "", "") Local $bLoaded = False If $hDll = 0 Then $hDll = DllOpen(@scriptdir&"\xd2txlib.dll") If $hDll = -1 Then Return SetError(2, "", "") $bLoaded = True Endif $aResult = DllCall($hDll, "int:cdecl", "ExtractText", "WSTR", $sFilename, "BOOL", $bProperties, "WSTR*", "") If $aResult[0] = 0 Then Return SetError(3, "", "") If $bLoaded = True Then DllClose($hDll) Return $aResult[3] EndFunc xd2txlib-example.zip
- 14 replies
-
- text extraction
- word
-
(and 3 more)
Tagged with:
-
Hello Experts, I have Zero experience with Autoit + Adobe Acrobat, and I really in need to get this working as PoC. I am trying to automate some manual actions below are the steps I would like to do. INPUT to script : 1. PDF file to open 2. String that I would like to add as \\Server\Directory name Steps : 1. Open the file in Adobe Acrobat Pro 2. Browse to View > Tools > Send For Review > Open (see image 1) 3. On the launched tool bar click on "Send for Shared Connecting" (see image 2) 4. Next select option "Automatically Collect comments on my..." in dropdown and click 'Next' (see image 3) 5. Select radiobutton "Network folder" and paste the input "\\Server\Directory" in text field and click 'Next' (see image 4) Experts, I would really appreciate a quick script which I can run and get rolling. Please note, I would not likwe to rely on MouseClick and/or cordinates match approach. PLEASE SUPPORT!!!! Makz ********************************************************************************************************** Image 1 Image 2 Image 3 Image 4
-
Hi guys! A pretty simple UDF to convert HTML to PDF using wkHTMLtoPDF. It uses the C API of the tool (DLL), so no external process, no ActiveX or COM sh*t. See the example, and the documentation of wkHTMLtoPDF. Cheers https://github.com/matwachich/wkhtmltopdf-au3
-
Hi every one . I want to read a pdf file and write into a excel using autoit , so how can i do this with out using third party server please tell me . Thank you..
-
Version 0.10
2,015 downloads
; #INDEX# ======================================================================================================================= ; Title .........: UDF for "Debenu Quick PDF Library" ; AutoIt Version : 3.3.10.2++ ; Language ......: English ; Description ...: A collection of functions for Debenu Quick PDF Library ; Author(s) .....: mLipok ; Modified ......: ; =============================================================================================================================== Release note: Erratum v0.7: Forum link: -
Hello I am trying to get chrome to save it's current webpage to a pdf using autoit. I wold like to save the file into a folder on the desktop called "ChromeFiles" . However when I use the send command chrome only occasionally responds. Thank you Simon
-
Hi guys, I am trying to read a pdf file with unstructured data. I dontot know how to handle pdf activities in AutoIt, Can you help me with any UDF to open the PDF and read the doc. Thanks for your time.
-
First of all IDK if it's OK to post this topic here and if not I'm asking to move it to the right place. Anyway I ask for help in the PDF UDF main thread but nobody has answer me yet and I really need help on this. See the problem started when I upgraded Autoit to its new version you can see the thread in the following link
-
Hi, I am trying to find more information on generating PDF files from AutoIT and found the UDF topic Also found some info on creating .FDF file and use PDFTK for merging, but i can't find info about a custom based layout. What i trying to find out is, if it is possible to generate a variable layout. For an example i created a script which is based out 20 fields and every field can contain information. If one of those fields are not filled, it shouldn't be printed on the PDF either. To make it more difficult, the PDF should contain a heading, the first 10 fields and then a horizontal line across the PDF and then a new heading and then show the last 10 fields. But only the fields which are filled. Is this possible?
-
Here: https://github.com/nachbar/TRichViewToPdfUsingDebenu/blob/master/Unit1.cpp I found a code in C++ for file format conversion from RTF to PDF with using Debenu QuickPDF. I know how to use Debenu QuickPDF in AutoIt . My question is about RTF part of this code: HDC hdcNew = debenu->GetCanvasDC( RTFPRINTINGDOTSPERINCH * RTFPAGEWIDTHININCHES, RTFPRINTINGDOTSPERINCH * RTFPAGEHEIGHTININCHES); canvas = new TCanvas; canvas->Handle = hdcNew; RVReportHelper1->DrawPage( PageCounter, canvas, true, RTFPRINTINGDOTSPERINCH * RTFPAGEHEIGHTININCHES); // LastPageHeight); First there is hdcNew declaration , and this is not the problem. My problem is in converting the following code snippet, to AutoIt canvas = new TCanvas; canvas->Handle = hdcNew; RVReportHelper1->DrawPage( PageCounter, canvas, true, RTFPRINTINGDOTSPERINCH * RTFPAGEHEIGHTININCHES); // LastPageHeight); If you remember, I created RTFPrinter sometime ago. But it was some time ago , and created by trial and error, rather than in-depth analysis. Also, it was just a modification of another script, not my own work from scratch. So now I'm looking for help how to adapt this code snippet to AutoIt. Any tips ? Regards, mLIpok
-
Hi Guys, I've been reading this post ... When I came accross the examples, non of them had what I was looking for. I basically want to "snapshot" my GUI's multiple tabs and send them into the pdf. A little nudge from you guys would be great. Im really stuck with this one, therefore I have no code. Lets discuss or point me in a right direction... thanks alot
-
Hey Everybody, as you know im on a very low autoit-level. My question is: How can i read all PDFs from a Folder wich is open and copy them to a Folder on a Desktop. The Folder wich contains the PDFs is variable Z:\Projektls\"*"*"*EVERYTIME ANOTHER ENDING"*"*"*"*" There can be 1 PDF or even 15 PDFs. i tried it with _FileListToArray and _FileCopy but i Need some help to understand this language THANKS!
- 3 replies
-
- _filelisttoarray
- _filecopy
-
(and 3 more)
Tagged with:
-
Hey Community, cause im too new in the Auto it world i will try it with the your help. hopefully. I woud like to know how i can handle my Problem. ---- I have a Excel Data with 362 random numbers. For Example: 1166642335374 1172899897343 ..... this numbers are a part of the filepath ...example D:\Projekte\1166_64233_5374 as u can see its the first number of the Excel data. After the first 4 numbers it shoud make a "_" than another 5 "_" This is my first question. How can i handle this to make it Shell execute. -------- Second question: If i am in the path. For Example: D:\Projekte\1166_64233_5374 the code shoud search for specific PDF Files. They are named like: 0050569E364B1ED79B900F73E62660EC.pdf the first 15 letters are always the same 0050569E364B1ED when he found this data he has to copy it on a Folder on the Desktop. (There can also be 2 or 3 pdfs in one Folder with this letters) ---- Please give me some help :-)
-
Good morning guys I'd like to know if there is a way to convert a PDF in CSV or, eventually, in TXT, in order to read from it, like a database... I have a PDF and I think ( I dind't search a lot on the forum ) with AutoIt, but I'd like work with Excel styles... Does anyone know a good program which convert PDF to CSV? PS: the PDF file is 5 MB, and it contains 439 pages... Thanks everyone for the help
-
Good morning I was looking around the forum if there were some customizable solutions about creating a PDF from "0" to something like a report... What I'd like to do is something with a header ( 2 logos and a title ), with a table which contains data read from a file At the moment, I was working with HTML, since I know it and it's very simple to do a table with some data inside... But know, I'm a bit stuck about the exporting the HTML page to PDF... And, here too, if someone knows how to do it, please, I'm here listening Thanks guys
-
I would like to present, the UDF for Debenu PDF Viewer SDK You can also find more info here: Debenu Quick PDF UDF In order to download the current version of the UDF, vist download section.