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)
- react-native-pdf giving error of Unable to resolve module react-native-blob-util HOT 1
- Requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs HOT 2
- Invariant Violation: requireNativeComponent: "RCTPdf" was not found in the UIManager.
- Need to update the version of the dependency library. HOT 1
- Starting Page is little bit scrolled up when {cache: true} HOT 1
- Critical security vulnerability due to crypto-js on v6.7.1 HOT 8
- error: cannot find symbol import com.wonday.rnpdf.RNPDFPackage; HOT 14
- package name missing from androidManifest causes pod install error HOT 3
- PDF preview issue in Android & iOS HOT 6
- import undefined.RNPDFPackage error with 6.7.3 HOT 5
- crypto-js is no longer maintained HOT 1
- App Crash with this.lastRNBFTask.cancel is not a function HOT 33
- 6.7.4 build issue HOT 1
- Please add lazy load function with large pdf file HOT 1
- import undefined.RNPDFPackage error HOT 4
- crypto-js 3.3.0 is vulnerable and please update to 4.2.0+ HOT 1
- Unable to load file from local file system HOT 1
- Unable to read online insecure PDF file HOT 3
- Double Tap on pdf Zoom disable Issue HOT 1
- Source file at path`xxxxxxxxxxxxxxxxxxxx.pdf.tmp` does not exist HOT 9
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.