Git Product home page Git Product logo

Comments (16)

wonday avatar wonday commented on August 16, 2024 4

我增加了 fitWidth属性来实现这个,
你们可以试试v1.2.9

from react-native-pdf.

wonday avatar wonday commented on August 16, 2024

现在做法,
如果是竖屏的话, 宽度缩放到显示控件宽度,然后一页一页竖着排下去
android和ios稍微有点区别, android是实际pdf页面高度一页一页排下去的。ios是按照显示控件的高度,一页一页排下去的。android是调底层库直接实现的, ios是我自己画的, 所以稍微有一点区别。
横排(左右翻页)类似, 只是方向反一下。

你说的希望自动缩放到屏宽?如果是想缩放到真是屏幕宽度, 那么请把pdf控件的宽度设置为屏幕宽度。
如果是指pdf描画内容缩放到pdf控件的宽度, 那么现在应该就是这个样子。

from react-native-pdf.

binlaniua avatar binlaniua commented on August 16, 2024

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'
    },

显示

tim 20170812111527

from react-native-pdf.

wonday avatar wonday commented on August 16, 2024

如果是竖版的话, 应该宽度和pdfview一致的。这个有点奇怪。
把你的pdf附上来,我看看?

from react-native-pdf.

wonday avatar wonday commented on August 16, 2024

我明白了,现在是为了显示一页, 横屏的时候左右就空很多了,你是要左右填满,一屏可以不显示一页。
我考虑一下怎么增加一下控制。

from react-native-pdf.

binlaniua avatar binlaniua commented on August 16, 2024

@wonday 好的,麻烦了

from react-native-pdf.

binlaniua avatar binlaniua commented on August 16, 2024

你这个配合, 转PDF工具, 简直完美

from react-native-pdf.

newbdez33 avatar newbdez33 commented on August 16, 2024

iOS上完美,但Android上报错,可能是我姿势不对?

wechatimg2

from react-native-pdf.

wonday avatar wonday commented on August 16, 2024

你再试试v1.3.0看看

from react-native-pdf.

newbdez33 avatar newbdez33 commented on August 16, 2024

还是同样的问题。

from react-native-pdf.

wonday avatar wonday commented on August 16, 2024

我这里正常的,难道真是你的打开方式不对。。。
把node_modules下面react-native-pdf删除,
然后再npm install一下看看?
把你的使用参数贴上来看看?

from react-native-pdf.

newbdez33 avatar newbdez33 commented on August 16, 2024

我把node_modules全删,android project clean之后试也不行。

import Pdf from 'react-native-pdf';

有这句就出错了。

from react-native-pdf.

wonday avatar wonday commented on August 16, 2024

是不是没有安装好,重新执行一下,下面命令试试?

npm install react-native-pdf --save
npm install react-native-fetch-blob --save

最后全部更新link一下

npm install
react-native link

from react-native-pdf.

newbdez33 avatar newbdez33 commented on August 16, 2024

可能是react-native版本的问题,我是0.42

from react-native-pdf.

wonday avatar wonday commented on August 16, 2024

用RN 0.42是有这个问题,这个版本已经不支持RN 0.42了, 最近Facebook做了一些改动,不向下兼容了,请升级RN吧。
我测试用的是最新的RN 0.47.1了。

from react-native-pdf.

newbdez33 avatar newbdez33 commented on August 16, 2024

OK,谢谢.

from react-native-pdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.