noellarkin Posted April 13, 2023 Posted April 13, 2023 I was looking for something that is equivalent to what sites like zamzar.com do:https://www.zamzar.com/convert/epub-to-txt/ Are there any existing UDFs that do this?
ioa747 Posted April 13, 2023 Posted April 13, 2023 (edited) he's not a UDF but he's doing this job. instead of .pdf give .epud file expandcollapse popupLocal $pdf = "D:\Documents\_pdf\MX Linux Users Manual.pdf" _PdfToTxt($pdf) ; #FUNCTION# ---------------------------------------------------------------------------- ; Name...........: _PdfToTxt() ; Description ...: Save pdf as text with SumatraPDF ; Syntax.........: _PdfToTxt($pdf [, $Dest]) ; Parameters ....: $pdf - The path of source pdf file ; $Dest - The dir destnation where txt file save ; Notes .........: if no $Dest parameter then destnation = source dir ; https://www.sumatrapdfreader.org/download-free-pdf-viewer ;---------------------------------------------------------------------------------------- Func _PdfToTxt($pdf, $Dest = "") Local $Sumatra, $hWnd, $hSvWnd, $txt, $aTmp $Sumatra = "D:\i\Pro\SumatraPDF-3.4.6\SumatraPDF-3.4.6-32.exe" If $Dest = "" Then $txt = StringTrimRight($pdf, 4) & ".txt" Else If StringRight($Dest, 1) = "\" Then $Dest = StringTrimRight($Dest, 1) EndIf $aTmp = StringSplit($pdf, "\", 1) $txt = $aTmp[$aTmp[0]] $txt = $Dest & "\" & StringTrimRight($txt, 4) & ".txt" EndIf Run('"' & $Sumatra & '" "' & $pdf & '"', "", @SW_MINIMIZE) $hWnd = WinWait("[CLASS:SUMATRA_PDF_FRAME]") ControlSend($hWnd, "", "SUMATRA_PDF_CANVAS1", "^s") $hSvWnd = WinWait("Save As") ControlSetText($hSvWnd, "", "ComboBox1", $txt) ControlCommand($hSvWnd, "", "ComboBox2", "SelectString", 'Text documents') ControlSend($hSvWnd, "", "Button2", "{ENTER}") WinClose($hWnd) EndFunc ;==>_PdfToTxt Edited April 13, 2023 by ioa747 I know that I know nothing
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now