React-pdf: Local image not rendering

Created on 20 Apr 2019  路  6Comments  路  Source: diegomura/react-pdf

Describe the bug
I am trying to get image from my local path, but the image is not showing in pdf. I believe it should be simple path defination, but tried with allowDangerousPaths in my react project. I am trying to do following:

<Image source="../../assets/ball.jpg" />

Expected behavior
Load image from the local path

Screenshots
image

All 6 comments

Only able to do it with data uri

You can't put a relative path. See https://react-pdf.org/components#source-object

Only able to do it with data uri

So how exactly did u resolve the issue using data uri?

Only able to do it with data uri

So how exactly did u resolve the issue using data uri?

I imported the image and passed it to src:

import Logo from 'assets/logo.png'
<Image style={styles.image} src={Logo} />

import Logo from 'assets/logo.png'

```

Imported images work fine no doubt. Images retrieved from enpoints however do not render. returns cors error

   <Image src={{uri:this.state.staffDocx?.imageUrl, method: 'GET', headers:{'Access-Control-Allow-Origin': '*'}}}/>

How I attempted it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kishaningithub picture kishaningithub  路  4Comments

mdodge-ecgrow picture mdodge-ecgrow  路  3Comments

jbrat picture jbrat  路  3Comments

benbenedek picture benbenedek  路  3Comments

pavle-lekic-htec picture pavle-lekic-htec  路  4Comments