如果我通过amp网址来响应本机webView,则会显示一个页面,询问用户是否重定向到amp页面。 我想在不带重定向的Web视图上显示amp页面,但是我该怎么做?
这是我使用的webview组件。 https://github.com/react-native-community/react-native-webview
from PyPDF2 import PdfFileReader
import os
import pytesseract
from pytesseract import image_to_string
import PIL.Image
from PIL import Image
from wand.image import Image as Img
import os
import glob
import concurrent.futures
import time
def no_of_pages(file):
pdf = PdfFileReader(open(file,'rb'))
pages = pdf.getNumPages()
return pages
def ocr(file):
print("Converting PDF to Image to Text....")
print(file)
text = ' '
im = PIL.Image.open(os.path.join(file))
text = text + image_to_string(im)
try:
os.remove(file)
except:pass
return text
os.environ['OMP_THREAD_LIMIT'] = '1'
def convert_pdf_to_image_to_txt():
dict_map = {}
path = "something"
file = "something"
f = "something"
with Img(filename=file, resolution=300) as img:
img.compression_quality = 99
img.save(filename = os.path.join('C://Users//aswathi.nambiar//Desktop//Output_Images',f + '.jpg'))
with concurrent.futures.ProcessPoolExecutor(max_workers=10) as executor:
image_list = glob.glob(path+"\\*.jpg")
i = 0
for img_path,text in zip(image_list,executor.map(ocr,image_list)):
print(img_path.split("\\")[-1],',',', processed')
dict_map[img_path.split("\\")[-1]] = text
print(dict_map)
pages = no_of_pages(file)
text = ' '
for i in range(0,pages):
print(f+'-'+str(i)+'.jpg')
print(dict_map[f+'-'+str(i)+'.jpg'])
text = text + dict_map[f+'-'+str(i)+'.jpg']
return text
所以这里是源uri,如果我将amp页面网址放在
<WebView
useWebkit
startInLoadingState
renderLoading={() => (
<View style={styles.spinnerContainer}>
<Spinner color={commonColor.lightBlue} />
</View>
)}
renderError={() => (
<NetworkError
refetch={() => {
WebViewRef && WebViewRef.reload();
}}
/>
)}
allowsBackForwardNavigationGestures
source={{ uri: url }}
/>
它显示一个页面,询问是否重定向到放大器页面。如果单击“是”,它会显示放大器页面。