react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

Barcode throwing error

Open moparlakci opened this issue 7 years ago • 7 comments

Hi, I want to show a barcode in the pdf document. I used the <Barcode value={'text'} /> component from "react-barcode"

But this component renders a svg element in the background, and I suppose only View, Text components are available within react-pdf, so it's throwing an error.

Is there a way to show it?

moparlakci avatar Dec 16 '18 14:12 moparlakci

Hey. The only way right now would be getting the svg as a jpeg or png image. Unfortunately svg are not supported right now (#29) but I plan to work on this soon!

diegomura avatar Dec 16 '18 19:12 diegomura

@moparlakci Did you figure out how to do this? I'm trying to do the exact same thing. Can't figure out how to get a jpeg or png from 'react-barcode'.

mdodge-ecgrow avatar Dec 10 '19 18:12 mdodge-ecgrow

Is this fixed ?

pradeepgudipati avatar Jan 10 '20 19:01 pradeepgudipati

SVGs are supported on 2.0. It's currently on npm as a beta version. Feel free to try rendering barcodes!

diegomura avatar Jan 13 '20 19:01 diegomura

I tried to use the current beta version (2.0.0-beta.5) from npmjs but I couldn't get it to work. Could you please provide an example for using react-pdf in combination with react-barcode?

rorschach-jl avatar Mar 12 '20 11:03 rorschach-jl

is there a sample with react-barcode?

fallenmel avatar Sep 18 '20 01:09 fallenmel

As suggested by @diegomura in some other post, Svg elements should be capitalized. But Barcode produces Svg with regular element case.

Expectation of ReactPDF:

<Svg> <Circle.... /> </Svg>

Barcode output:

<svg> <circle... /> </svg>

yogeshmuthuraj avatar Apr 28 '21 06:04 yogeshmuthuraj