Четверг, 25.04.2024
Мой сайт
Меню сайта
Статистика

Онлайн всего: 1
Гостей: 1
Пользователей: 0
Форма входа
Главная » Гостевая книга [ Добавить запись ]

Страницы: 1
Показано 1-5 из 5 сообщений
5. Александр   (23.01.2015 13:54)
0  
Здравствуйте. Свой опыт по применению ваших скриптов по пакетному автоматическому распознаванию PDF и Djvu описал вот здесь:
http://vedomo.ru/a/s/paketnaia/AutoItOcrpdf.htm

http://vedomo.ru/a/s/paketnaia/AutoItOcrDjvu/AutoItOcrDjvu.htm

4. Руслан   (15.11.2011 00:03)
0  
Здравствуйте, почему-то Ваш скрипт (pdf_rename)не хочет работать с русским шрифтом. Помогите пожалуйста с этой проблемой.
С уважением, Руслан
Ответ: попробуйте такой скрипт:
#Include <Array.au3>

$search = FileFindFirstFile("*.pdf")


If $search = -1 Then
MsgBox(0, "Error", "No files/directories matched the search pattern")
Exit
EndIf
$i=0
Dim $file[1]
;_ArrayDisplay($file, "$avArray AFTER _ArrayAdd()")
While 1
$file_n=FileFindNextFile($search)
If @error Then ExitLoop
_ArrayAdd($file, $file_n )
; _ArrayDisplay($file, "$avArray AFTER _ArrayAdd()")
$i=$i+1
WEnd
FileClose($search)
;_ArrayDisplay($file, "$avArray AFTER _ArrayAdd()")
For $j=1 To $i
RunWait("pdftohtml.exe -f 1 -l 1 -hidden -xml -enc UTF-8 "&$file[$j]&" out",'''',@SW_HIDE )
$out = FileOpen("out.xml", 0); find max font size

If $out = -1 Then
MsgBox(0, "Error", "Unable to open xml file.")
Exit
EndIf

$max_font=1
While 1
$line = FileReadLine($out)
If @error = -1 Then ExitLoop
$line=StringRegExpReplace($line,''<text.*height="'','''')
$line=StringRegExpReplace($line,''" font.*'','''')
If StringIsInt($line) Then
$font=Number($line)
if $font>$max_font Then $max_font=$font
EndIf
Wend



FileClose($out)

$out = FileOpen("out.xml", 0); find name document
If $out = -1 Then
MsgBox(0, "Error", "Unable to open xml file.")
Exit
EndIf

$name=''''
While 1
$line = FileReadLine($out)
If @error = -1 Then ExitLoop
If StringRegExp($line,''<text.*height="''&$max_font) Then
$temp=StringRegExpReplace($line,''<text.*">'','''')
$temp=StringRegExpReplace($temp,''</text>'','''')
$name=$name&'' ''&$temp
EndIf
Wend




FileClose($out)
$name=StringStripWS ( $name, 1)
$name=StringReplace($name,''<b>'','''')
$name=StringReplace($name,''</b>'','''')
$name=StringReplace($name,''i>'','''')
$name=StringReplace($name,''</i>'','''')
$name=StringStripWS ( $name, 3 )
$name=StringStripCR ( $name)
$name=_Utf8ToAnsi($name)
;$name=_Utf8ToUnicode($name)
;MsgBox(0, "Error", $name)
;MsgBox(0, $name, $file[$j])

If $name<>'''' Then FileCopy ( $file[$j], $name&''.pdf'' , 1 )
Next





Func _Utf8ToAnsi($utf8string); (c) ViSiToR
Local $len = StringLen($utf8string)
Local $buf = DllStructCreate("byte[" & $len*2 & "];byte[2]")
Local $ret = DllCall("Kernel32.dll", "int", "MultiByteToWideChar", _
"int", 65001, "int", 0, _
"str", $utf8string, "int", -1, _
"ptr", DllStructGetPtr($buf), "int", $len*2+2)
Local $out = DllStructCreate("char[" & $len & "];char")
$ret = DllCall("kernel32.dll", "int", "WideCharToMultiByte", _
"int", 0, "int", 0, _
"ptr", DllStructGetPtr($buf), "int", -1, _
"ptr", DllStructGetPtr($out), "int", $len+1, _
"int", 0, "int", 0)
Return DllStructGetData($out,1)
EndFunc
Func _Utf8ToUnicode($Utf8String) ; (c) ViSiToR
Local $BufferSize = StringLen($Utf8String) * 2
Local $Buffer = DllStructCreate("byte[" & $BufferSize & "]")
Local $Return = DllCall("Kernel32.dll", "int", "MultiByteToWideChar", _
"int", 65001, _
"int", 0, _
"str", $Utf8String, _
"int", StringLen($Utf8String), _
"ptr", DllStructGetPtr($Buffer), _
"int", $BufferSize)
Local $UnicodeBinary = DllStructGetData($Buffer, 1)
$UnicodeHex1 = StringReplace($UnicodeBinary, "0x", "")
$StrLen = StringLen($UnicodeHex1)
Local $UnicodeString
For $i = 1 To $StrLen Step 4
$UnicodeHex2 = StringMid($UnicodeHex1, $i, 4)
$UnicodeHex3 = StringMid($UnicodeHex2,3,2) & StringMid($UnicodeHex2,1,2)
$UnicodeString &= ChrW(Dec($UnicodeHex3))
Next
$Buffer = 0
Return $UnicodeString
EndFunc

3. Alex   (07.09.2011 04:25)
0  
Доброго времени суток!
Недавно столкнулся с проблемой как ТС из этой темы http://72.233.112.78/topic.cgi?forum=5&topic=16938

Только у меня в первой странице pdf файла картинка, соответственно текст для переименования надо брать со второй страницы файла pdf. Пытался модифицировать ваш скрипт, но у меня ничего не получилось.

Не могли бы вы помочь?
моя почта alexcv@ukr.net

2. Eduardo Serna   (19.01.2010 12:23)
0  
Dear alexrey036,

I am interested in your software that transfers the OCR layer from djvu to pdf but I have no clue how to use it.
I have a djvu file with ocr and an equivalent pdf (created from the djvu with pdfcreator) with no OCR, where next?

Thanks for your help

1. DANIIL   (29.07.2008 17:18)
0  
Привет!

Есть пара вопросов, стукни в аську 454829859, если не сложно!?

С уважением, Даниил.

1-5

Имя *:
Email *:
WWW:
Код *:
Поиск
Друзья сайта
  • Создать сайт
  • Официальный блог
  • Сообщество uCoz
  • FAQ по системе
  • Инструкции для uCoz
  • Все проекты компании
  • Copyright MyCorp © 2024
    Бесплатный хостинг uCoz