Pdf.js: ctrl + fでの検索は2つの単語では機能しません

作成日 2018年05月17日  ·  4コメント  ·  ソース: mozilla/pdf.js

ここにPDFファイルを添付(推奨)またはリンクします:
dee752ed0f726d8785abf360ca783d91f96f9a2e.pdf

構成:

  • Webブラウザとそのバージョン:Firefox 60 / Chromium 66
  • オペレーティングシステムとそのバージョン:Linux / Windows 7
  • PDF.jsバージョン:v1.10.88またはv1.9.426、またはFirefox60に組み込まれているバージョン

問題を再現する手順:

  1. ctrl + fを押して、「のパイオニア」を検索します
  2. パイオニアが強調表示されますが、スペースを入力するとすぐに結果が見つかりません

pdftotextは正しいテキストを示しています:

in nit ris hington 1D C
boerge W lacan a pioneer of butali
and an influential man aw at richfield last walk

Chromeの組み込みPDFビューアで動作するため、PDFに問題はありません。

ビューアへのリンク(mozilla.github.io/pdf.js以外のサイトでホストされている場合、またはFirefox / Chrome拡張機能としてホストされている場合):
https://newspapers.lib.utah.edu/pdfjs1.9/web/viewer.html?file=/udn_files/de/e7/dee752ed0f726d8785abf360ca783d91f96f9a2e.pdf

4-text-selection

最も参考になるコメント

私はこれに取り組みたいです、
@timvandermeijこの問題に取り組んでいる間、どこから

全てのコメント4件

私はこれに取り組みたいです、
@timvandermeijこの問題に取り組んでいる間、どこから

検索が機能しない理由を説明している可能性があるため、最初にテキストレイヤーにあるものを確認することをお勧めします。 私の推測では、スペースファクターは正しくありません。 参照: https

これは、他の多くのオープンテキスト選択の問題の原因でもある可能性があります。 ただし、値を変更すると、他のPDFファイルでエラーが発生しやすくなり、適切なテストが必要になります。 他のオープンソースPDFビューア(Popplerなど)がこれをどのように行うかを確認する必要がある場合があります。これは、PDF仕様では、テキスト選択にスペースを使用する必要がある時期が示されていないためです。 文字間の間隔幅のみを定義しました。

残念ながら、 https: //github.com/mozilla/pdf.js/issues/9736#issuecomment -390629834はここでは役に立ちません。これはスキャンされたファイルであり、すべての単語が異なるフォントサイズとx / y座標で個別に配置されているためです。 たとえば、 /Contentsストリームの先頭を参照してください。

1 G
1 g
1 0 0 1 52 1145.37 Tm
/F1 11 Tf
(UTAH)Tj
1 0 0 1 90 1146.36 Tm
/F1 11 Tf
(NEWS)Tj
1 0 0 1 29 1124.14 Tm
/F1 10 Tf
(the)Tj
1 0 0 1 44 1126.03 Tm
/F1 8 Tf
(oregon)Tj
1 0 0 1 71 1124.47 Tm
/F1 9 Tf
(short)Tj
1 0 0 1 92 1125.47 Tm
/F1 9 Tf
(line)Tj

...

こんにちは皆さん、他のPDFレンダリングプロジェクトもこれに苦しんでいることをご存知だと思います。 私は現在、ブラウザアプリケーションのPDFレンダラーとしてpdf.jsを使用するWebアプリ(Nextcloud)を使用しています。

これは私が他のユーティリティで使用したファイルの例です。 これは、航空機の自動操縦サービスマニュアルからのスキャンされた抜粋であり、元々は1970年代に未知の機器に印刷されました。

CenturyIIB-origscan.pdf
CenturyIIB-tesseract_hocr-uncleaned.pdf
CenturyIIB-tesseract_hocr-cleaned.pdf

最初のファイルは、テキストレイヤーのない元のスキャンです。 2番目(hocr-uncleaned)は、非表示のテキストレイヤーを作成するためにTesseract(v4.0)で処理されたPDF / Aです。 3番目(hocr-uncleaned)は、 unpaper(v6.1)でスキューが解除され、同じバージョンのTesseractでOCR処理され、PDF / Aとして出力されます。 どちらのPDF / Aの場合も、元のスキャンは最終出力用に300 dpijpegにトランスコードされています。

2番目と3番目のケースの両方で、Tesseractを使用した「hocr」レンダリングオプションがOCRレンダリングステージに使用されました(Tesseractには複数の内部レンダラーがあります)。 githubのTesseractの問題フォーラムを見ると、この問題にも取り組むために、最近のレンダラーにいくつかの変更が加えられていることがわかります。

さまざまなユーティリティからコピー/貼り付けされた抜粋を次に示します...

hocr-Safari 11.1(13605.1.33.1.4)では非公開

The Century IIB Autopilot is an "Open Loop" system which responds only to the dynamics of the aircraft in flight, thus the only ground checks that can be accomplished are functional checks as described in this bulletin.

hocr-Chromeで未洗浄66.0.3359.181

The Century IIB Autopilot is an "Open Loop" system which responds only to the dynamics of the aircraft in flight, thus the only ground checks that can be accomplished are functional checks as described in this bulletin.

hocr-Adobe Acrobat ProXで未洗浄

The Century IIB Autopilot is an "Open Loop" system which responds only to the
dynamics of the aircraft in flight, thus the only ground checks that can be
accomplished are functional checks as described in this bulletin.

hocr-pdf.jsで未クリーン(Firefox 60.0.1)

Century
IIB
Autopilot
is
an
"Open Loop"
system
which
responds
only
to
the
dynamics
of
the
aircraft
in
flight,
thus
the
only
ground
checks
that
can
be
accomplished
are
functional
checks
as
described
in
this
bulletin.

上記の同じバージョンのSafariでhocr-cleaned

The Century IIB Autopilot is an "Open Loop’ system which responds only to the dynamics of the aircraft in flight, thus the only ground checks that can be accomplished are functional checks as described in this bulletin.

上記の同じバージョンのChromeでhocr-cleaned

The Century IIB Autopilot is an "Open Loop’ system which responds only to the
dynamics of the aircraft in flight, thus the only ground checks that can be
accomplished are functional checks as described in this bulletin. 

上記の同じバージョンのAdobeAcrobatProでhocr-cleaned

The Century IIB Autopilot is an "Open Loop’ system which responds only to the
dynamics of the aircraft in flight, thus the only ground checks that can be
accomplished are functional checks as described in this bulletin.

上記の同じバージョンのpdf.js(Firefox)でhocr-cleaned

Century 
IIB 
Autopilot 
is 
an 
"Open 
Loop’ 
system 
which 
responds 
only 
to 
the 
dynamics 
of 
the 
aircraft 
in 
flight, 
thus 
the 
only 
ground 
checks 
that 
can 
be 
accomplished 
are 
functional 
checks 
as 
described 
in 
this 
bulletin. 

他のサンプルファイル(メイン/ _depedency _)用に私のツールチェーンを再現したい人のために...

tesseract 4.00.00alpha (OCR用)
_leptonica 1.76.0
libjpeg-turbo 1.5.3
libpng 1.6.34 + apng
libtiff 4.0.9_

unpaper 6.1 (スキュー除去、ノイズ除去など)
_libav 12.1
opencv 2.4.13.1
freetype2 2.8_

qpdf 8.0.1 (pdfの検査/変更/作成用)
_ghostscript 9.16_

OCRmyPDF 6.2.0 (上記のユーティリティ用のpython v3ラッパー)

上記のすべては事実上すべての一般的なLinuxパッケージリポジトリにあり、OCRmyPDFはpipにあり、それらすべての最新のビルドはOSX用のHomebrewにもあります(v4.0はまだベータとしてマークされているため、tesseractはgit HEADにタグ付けする必要があります) 。 また、それらすべてをFreeBSDで実行しました(Tesseract、Leptonicaをビルドし、ソースからunpaperを作成する必要があります)。 私の意見では、Tesseract / Leptonicaはそのようなテストファイルを作成するために使用するのに最適なベースラインです。 彼らはオープンソースOCRを飛躍的に前進させました。 これは、18世紀の文書のスキャンからの例

このページは役に立ちましたか?
0 / 5 - 0 評価

関連する問題

jigskpatel picture jigskpatel  ·  3コメント

hp011235 picture hp011235  ·  4コメント

azetutu picture azetutu  ·  4コメント

sujit-baniya picture sujit-baniya  ·  3コメント

smit-modi picture smit-modi  ·  3コメント