Thanks. i found this http://codegist.net/snippet/java/bufferedimagetranscoderjava_comfreek_java
the generated is not as crisp and clear though. On Thu, Jun 1, 2017 at 8:48 PM, Thad Humphries <[email protected]> wrote: > On Thu, Jun 1, 2017 at 8:13 AM, chitgoks <[email protected]> wrote: > > > Hi Peter > > > > PDImageXObject imageSig = LosslessFactory.createFromImage(pdfDocument, > > ImageIO.read(new > > ByteArrayInputStream(DatatypeConverter.parseBase64Binary(base64Png)))); > > > > works if base64 string is png.. > > > > but it does not work if the base 64 is an svg. > > > > data:image/svg+xml;base64,PHN2ZyB4bW...... > > > > is this a limitation? > > > > please advise > > > > mark > > > PDImageXObject requires a bitmap image. Internally it holds a > java.awt.image.BufferedImage. You will need to convert your SVG to a > BufferedImage. I've not done this, but code on there is code on > Stackoverflow for it using Apache Batik: > https://stackoverflow.com/a/13931120/1316011 > > > > > > > > Website/Java Games: http://www.chitgoks.com > > My Blogs: > > http://tech.chitgoks.com > > http://wuhtevah.chitgoks.com > > http://disneyusa.blogspot.com > > > > On Thu, Jun 1, 2017 at 8:08 PM, Peter Pinnau < > [email protected] > > > > > wrote: > > > > > Hallo > > > > > >> but the sample shows loading it from a file. > > >> > > >> im looking to create a BufferedImage from a base64 svg string. has > > anybody > > >> tried this? > > >> > > > I think you can create a PDImageXObject object from a BufferedImage > using > > > > > > org.apache.pdfbox.pdmodel.graphics.image.JPEGFactory factory > > > > > > JPEGFactory.createFromImage( PDDocument, BufferedImage , float quality, > > > int resolution); > > > > > > > > > -- > > > Viele Grüße > > > Peter Pinnau > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [email protected] > > > For additional commands, e-mail: [email protected] > > > > > > > > > > > > -- > "Hell hath no limits, nor is circumscrib'd In one self-place; but where we > are is hell, And where hell is, there must we ever be" --Christopher > Marlowe, *Doctor Faustus* (v. 121-24) >

