我使用带有iframe src=viewer.html?file=...标记的PDF.js嵌入了PDF .我正在使用PDF.js及其viewer.html,因为它已经提供了我在其他任何示例中都找不到的搜索功能.
我希望用户能够单击<td>并使用包含文本来搜索PDF并跳转到第一次出现.JSFiddle:http://jsfiddle.net/agyetcsj/
HTML
<div id="tableDiv"><table border="1" width="400px"><tr><td>6.5 Calling External Functions</td></tr></table></div>
<iframe id="pdfImage" width="600px" height="600px" class="pdf" src="http://mozilla.github.com/pdf.js/web/viewer.html?file=compressed.tracemonkey-pldi-09.pdf"></iframe>
Run Code Online (Sandbox Code Playgroud)
JavaScript的
$('td').unbind('click').click(function () {
alert("Find text in PDF!");
});
Run Code Online (Sandbox Code Playgroud)
我在SO上发现了类似的问题,但他们无法真正回答我的问题:
谢谢!
我有一个数字形式的原始页面和同一页面的几个扫描版本.我的目标是对扫描的页面进行校正,使其尽可能与原始页面匹配.我知道我可以使用此处所述的概率霍夫变换来固定旋转,但扫描的纸张尺寸也不同,因为有些人将页面缩放为不同的纸张格式.我认为OpenCV中的findHomography()函数与SIFT/SURF的关键点组合正是我解决这个问题所需要的.但是,我只是无法让我的deskew()函数工作.
我的大部分代码源自以下两个来源:http: //www.learnopencv.com/homography-examples-using-opencv-python-c/和http://docs.opencv.org/3.1.0/d1/ de0/tutorial_py_feature_homography.html.
import numpy as np
import cv2
from matplotlib import pyplot as plt
# FIXME: doesn't work
def deskew():
im_out = cv2.warpPerspective(img1, M, (img2.shape[1], img2.shape[0]))
plt.imshow(im_out, 'gray')
plt.show()
# resizing images to improve speed
factor = 0.4
img1 = cv2.resize(cv2.imread("image.png", 0), None, fx=factor, fy=factor, interpolation=cv2.INTER_CUBIC)
img2 = cv2.resize(cv2.imread("imageSkewed.png", 0), None, fx=factor, fy=factor, interpolation=cv2.INTER_CUBIC)
surf = cv2.xfeatures2d.SURF_create()
kp1, des1 = surf.detectAndCompute(img1, None)
kp2, des2 = surf.detectAndCompute(img2, None)
FLANN_INDEX_KDTREE = 0
index_params …Run Code Online (Sandbox Code Playgroud)