PDF UDF/ Hilfe?

  • Hi,

    gibts es ein PDF-UDF (hab nur ein PDFCreator UDF finden können)?
    und zwar habe ich eine pdf-datei die wie im folgenden bild aufgebaut ist.

    ich hätte gerne ein programm, dass mir zum einem die Nr. neben der 12.00 und den dazugehörigen preis ausliest und abspeichert (summe)

    die 12.00 ist fortlaufend, also von 01.00 bis ende offen.
    die nr. daneben fängt auch nicht immer mit A an, kann also komplett variiren und auch unterschiedlich lang sein.

    gibt es da ne möglichkeit?

    PS: ich kann die pdf auch als txt abspeichern, aber dann haut er alles durcheinander =(
    und im text (unter dem schwarzen) können auch nr. und preise auftauchen, die ich aber nicht zu beachten habe.

    • Offizieller Beitrag

    Hi,

    habe dein Bild als bmp gespeichert, dann bekomme ich so zumindest die Nr raus:

    Spoiler anzeigen
    [autoit]

    #include<Array.au3>
    #include<GUIConstants.au3>
    #include<ScreenCapture.au3>
    ;================================= OCR =======================================
    ; Function Name:
    ; Description: Searches a bmp file for all recognizable characters and returns them in an array
    ; Requires: Microsoft Word must be installed on system & <Array.au3>
    ; Parameters: $file bmp file to search
    ;
    ; Syntax: _OCR($file)
    ; Author(s): ofLight
    ; Returns: $Array[1] = 0 on failure, $Array on success
    ;
    ; EG: _PixelShow_Virtual(25,25,25,25)
    ; Sleep(1000)
    ; $output = _OCR("C:\ofLight\Current AU3 Scripts\Render.bmp")
    ; _ArrayDisplay($output)
    ;===============================================================================
    Global $file = 'pdf.bmp', $oMyError
    $re = _OCR($file)
    _ArrayDisplay($re)
    sleep(2000)
    _PixelShow_Virtual(0,0,1024,768,1, $file)

    while 1
    Sleep(1000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _OCR($file)
    Dim $miDoc, $Doc, $str, $oWord, $sArray[500]
    $oMyError = ObjEvent("AutoIt.Error", "_CoMErrFunc")
    $miDoc = ObjCreate("MODI.Document")
    $miDocView = ObjCreate("MiDocViewer.MiDocView")
    $miDoc.Create($file)
    $miDoc.Ocr(9, True, False)
    $miDocView.Document = $miDoc
    $miDocView.SetScale(0.75, 0.75)
    $i = 0
    For $oWord In $miDoc.Images(0).Layout.Words
    $str = $str & $oWord.text & @CRLF
    ; ConsoleWrite($oWord.text & @CRLF)
    $sArray[$i] = $oWord.text
    $i += 1
    Next
    Return $sArray
    EndFunc ;==>_OCR

    [/autoit] [autoit][/autoit] [autoit]

    ;================================= PixelShow_Virtual =========================
    ; Function Name: _PixelShow_Virtual
    ; Description: Used to mouseover Content and recieve CoOrds and Pixelcolor
    ; Requires:
    ; Parameters: $l
    ; $t
    ; $r
    ; $b
    ; $stats Default is Stats = 1 tooltip on, if stats = 0 tooltip off
    ; $FileName Virtaul rendered image name, Default is Render.bmp
    ; $WinName Rendered window title, default is "Render VD"
    ; Syntax: _PixelShow_Virtual($l, $t, $r, $b, $Stats, $FileName, $WinName)
    ; Author(s):
    ; Returns:
    ;===============================================================================
    Func _PixelShow_Virtual($l=20,$t=20,$r=20,$b=20,$Stats=1,$FileName = ".\Render.bmp",$WinName = "Render VD")
    Local $FileSize = 0
    Global $GUIRenderPic
    $xy = MouseGetPos()
    Sleep(40)
    ;_ScreenCapture_Capture ($FileName, $xy[0]-$l, $xy[1]-$t, $xy[0]+$r, $xy[1]+$b)
    If FileGetSize($FileName) <> $FileSize Then
    If WinExists($WinName) Then
    GUICtrlSetImage($GUIRenderPic,$FileName)
    GUISetState(@SW_SHOW)
    Else
    $GUIRendersize = _ImageGetSize($FileName)
    $GUIRenderDisp = GUICreate($WinName, $GUIRendersize[0], $GUIRendersize[1], (@DesktopWidth-5) - $GUIRendersize[0], 145, $WS_POPUP)
    $GUIRenderPic = GUICtrlCreatePic($FileName,0,0,$GUIRendersize[0],$GUIRendersize[1])
    GUISetState(@SW_SHOW)
    EndIf
    $FileSize = FileGetSize($FileName)
    EndIf
    If $Stats=1 Then
    $Loc = WinGetPos($WinName)
    ToolTip("Color = "&PixelGetColor($Loc[0]+($Loc[2]/2),$Loc[1]+($Loc[3]/2))&@LF&"X: "&$xy[0]&" "&"Y: "&$xy[1])
    EndIf
    EndFunc;========================== PixelShow_Virtual =========================

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _ImageGetSize($sFile);SUB Function
    Local $sHeader = _FileReadAtOffsetHEX($sFile, 1, 24); Get header bytes
    Local $asIdent = StringSplit("FFD8 424D 89504E470D0A1A 4749463839 4749463837 4949 4D4D", " ")
    Local $anSize = ""
    For $i = 1 To $asIdent[0]
    If StringInStr($sHeader, $asIdent[$i]) = 1 Then
    Select
    Case $i = 2; BMP
    $anSize = _ImageGetSizeSimple($sHeader, 19, 23, 0)
    ExitLoop
    EndSelect
    EndIf
    Next
    If Not IsArray($anSize) Then SetError(1)
    Return ($anSize)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _FileReadAtOffsetHEX($sFile, $nOffset, $nBytes);SUB Function
    Local $hFile = FileOpen($sFile, 0)
    Local $sTempStr = ""
    FileRead($hFile, $nOffset - 1)
    For $i = $nOffset To $nOffset + $nBytes - 1
    $sTempStr = $sTempStr & Hex(Asc(FileRead($hFile, 1)), 2)
    Next
    FileClose($hFile)
    Return ($sTempStr)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ImageGetSizeSimple($sHeader, $nXoff, $nYoff, $nByteOrder);SUB Function
    Local $anSize[2]
    $anSize[0] = _Dec(StringMid($sHeader, $nXoff * 2 - 1, 4), $nByteOrder)
    $anSize[1] = _Dec(StringMid($sHeader, $nYoff * 2 - 1, 4), $nByteOrder)
    Return ($anSize)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Dec($sHexStr, $nByteOrder);SUB Function
    If $nByteOrder Then Return (Dec($sHexStr))
    Local $sTempStr = ""
    While StringLen($sHexStr) > 0
    $sTempStr = $sTempStr & StringRight($sHexStr, 2)
    $sHexStr = StringTrimRight($sHexStr, 2)
    WEnd
    Return (Dec($sTempStr))
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _CoMErrFunc();SUB Function
    Local $HexNumber=hex($oMyError.number,8)
    Msgbox(0,"COM Error 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) ; to check for after this function returns
    Endfunc

    [/autoit]

    Mega