cnjon / react-native-pdf-view

React Native PDF View
MIT License
404 stars 167 forks source link

Images inside PDF file incorrectly rendered #23

Closed vspedr closed 8 years ago

vspedr commented 8 years ago

Hello,

I noticed that some images inside a PDF file were not properly rendered in the app (running in a physical Android device), as you can see in the screenshot below, although the same file shows up nicely in a browser or webview. If I'm not mistaken, those are PNG images embedded into the PDF file.

screenshot_20160728-093702

This is the page where the problem occurs: aaa-4.pdf

We've set up a rendering function like this:

  _renderPDF() {
    if (Platform.OS === 'android') {
      return <RNPDFView
        ref={(pdf)=>{this.pdfView = pdf;}}
        key="sop"
        zoom={1}
        path={this.pdfPath}
        onLoadComplete = {(pageCount)=>{
          console.warn(pageCount);
          //this.zoom();
        }}
        style={styles.pdf} />;
    } else {
      return <WebView
        ref={'wb'}
        automaticallyAdjustContentInsets={false}
        scalesPageToFit={true}
        style={styles.pdf}
        source={{uri: this.state.url, headers: {
          'Content-type':'application/pdf'
        }}}
        decelerationRate="normal"/>;
    }
  }

Is there any fix or workaround for this?

pareekkhushboo77 commented 8 years ago

@vspedr any luck? can you post the code? what is passed in path={this.pdfPath}?

vspedr commented 8 years ago

Hello, sorry for the delayed response. We couldn't replicate the issue with different files, so there may be something wrong with this particular file in my tests. I'm closing the issue for now, thanks for your attention!