Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

742
Views
View base64 pdf in webview react native on iOS?

Here is what I am trying

const [pdf, setPdf] = useState("")

let image = "data:application/pdf;base64," + curr.Body.toString('base64');

setPdf(image)

<WebView
            style={styles.pdf}
            useWebKit={true}
            originWhitelist={['*']}
            scrollEnabled={true}
            mediaPlaybackRequiresUserAction={true}
            source={{
                html: `
            <html>
            <object data="${pdf}" type="application/pdf">
                <embed 
                    scrollbar="1" 
                    src="${pdf}" 
                    type="application/pdf" 
                   
                />
            </object>
            </html>
            ` }}
        />

the below is what i am getting. The PDF contains 5 pages but i am getting only one on the screen.

enter image description here

help me to get the full pdf to the view.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

try to wrap your code with a ScrollView to make the content visible/scrollable :

<SafeAreaView style={{flex: 1}}>
      <ScrollView
        style={{ width: '100%' }}
        contentContainerStyle={{ flexGrow: 1 }}
      >
        <WebView
            style={styles.pdf}
            useWebKit={true}
            originWhitelist={['*']}
            scrollEnabled={true}
            mediaPlaybackRequiresUserAction={true}
            source={{
                html: `
            <html>
            <object data="${pdf}" type="application/pdf">
                <embed 
                    scrollbar="1" 
                    src="${pdf}" 
                    type="application/pdf" 
                   
                />
            </object>
            </html>
            ` }}
        />
      </ScrollView>
    </SafeAreaView>

Or you can use a library dedicated for reading pdfs, such as : https://www.npmjs.com/package/rn-pdf-reader-js Here is an example :

<PDFReader
    style={{flex:1, flexGrow:1}}
        source={{
          uri: 'http://www.africau.edu/images/default/sample.pdf',
        }}
      />
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!