Comments (16)
我增加了 fitWidth属性来实现这个,
你们可以试试v1.2.9
from react-native-pdf.
现在做法,
如果是竖屏的话, 宽度缩放到显示控件宽度,然后一页一页竖着排下去
android和ios稍微有点区别, android是实际pdf页面高度一页一页排下去的。ios是按照显示控件的高度,一页一页排下去的。android是调底层库直接实现的, ios是我自己画的, 所以稍微有一点区别。
横排(左右翻页)类似, 只是方向反一下。
你说的希望自动缩放到屏宽?如果是想缩放到真是屏幕宽度, 那么请把pdf控件的宽度设置为屏幕宽度。
如果是指pdf描画内容缩放到pdf控件的宽度, 那么现在应该就是这个样子。
from react-native-pdf.
android下, pdf显示的内容, 和给pdfview设置的宽度不一致
组件
<Pdf ref={(pdf) => { this.pdf = pdf; }}
source={{ uri: `xxxxx` }}
page={1}
horizontal={false}
onLoadComplete={(pageCount) => {
}}
onPageChanged={(page, pageCount) => {
}}
onError={(error) => {
}}
style={styles.pdf} />
样式
pdf: {
flex: 1,
backgroundColor: '#FF0000'
},
显示
from react-native-pdf.
如果是竖版的话, 应该宽度和pdfview一致的。这个有点奇怪。
把你的pdf附上来,我看看?
from react-native-pdf.
我明白了,现在是为了显示一页, 横屏的时候左右就空很多了,你是要左右填满,一屏可以不显示一页。
我考虑一下怎么增加一下控制。
from react-native-pdf.
@wonday 好的,麻烦了
from react-native-pdf.
你这个配合, 转PDF工具, 简直完美
from react-native-pdf.
iOS上完美,但Android上报错,可能是我姿势不对?
from react-native-pdf.
你再试试v1.3.0看看
from react-native-pdf.
还是同样的问题。
from react-native-pdf.
我这里正常的,难道真是你的打开方式不对。。。
把node_modules下面react-native-pdf删除,
然后再npm install一下看看?
把你的使用参数贴上来看看?
from react-native-pdf.
我把node_modules全删,android project clean之后试也不行。
import Pdf from 'react-native-pdf';
有这句就出错了。
from react-native-pdf.
是不是没有安装好,重新执行一下,下面命令试试?
npm install react-native-pdf --save
npm install react-native-fetch-blob --save
最后全部更新link一下
npm install
react-native link
from react-native-pdf.
可能是react-native版本的问题,我是0.42
from react-native-pdf.
用RN 0.42是有这个问题,这个版本已经不支持RN 0.42了, 最近Facebook做了一些改动,不向下兼容了,请升级RN吧。
我测试用的是最新的RN 0.47.1了。
from react-native-pdf.
OK,谢谢.
from react-native-pdf.
Related Issues (20)
- Pdf not loading first time in Android ,gives error open failed:ENONT HOT 8
- rn 0.73.8版本,android上不显示红色盖章和姓名
- Links on iOS not working due to code change introduced with the new `enableDoubleTapZoom` option HOT 6
- HyperLinks on onPressLink is not working in IOS. HOT 11
- pdf file not fully 100% loaded... stops after 80-90% HOT 5
- Android: Does not work with any remote URL - Possible unhandled promise rejection (id: 2): Error: /data/user/... open failed: ENOENT (No such file or directory) HOT 12
- Cannot scroll inside GestureDetector on Android HOT 1
- Android crash: Segmentation violation (invalid memory reference)
- Android: Native crash app error "PDF renderer" HOT 2
- Annotations for Android HOT 2
- PDF zooming not working as expected for iOS
- scrollEnabled property is missing as available prop for pdf viewer
- blank screen (android 11 and above) HOT 2
- Android, v6.7.5 can not view fully content of document
- Zooming with singlepage true HOT 1
- iOS only - Exception thrown while executing UI block: - [RNPDFPdfView setOnClick:]: unrecognized selector send to instance HOT 2
- for expo 51 react-native-pdf is not working HOT 2
- Unable to open mach-O at path: default.metallib Error:2
- Landscape View cripples for whole App after PDF file is opened
- `new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-pdf.