Rendering Images inside PDF, images not being rendered in PDF Viewer 0.1.8
Asked Answered
O

2

6

Please check updates as they have additional informations... Apparently located the problem in a specific pdf client but cannot close the issue with an open bounty...

I am generating a pdf using grails rendering plugin. The PDF has a couple of images inside and "some" of them are not being outputted!

I am rendering the images inline via data uris as required by the plugin. That means that all my images are something like:

<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQECWAJYAAD...">

If I render them in a normal html view, I can see the images just fine! If I render the template to a JPG/PNG with the same plugin, again the images render all fine.

If I render to PDF the images which are being retrieved by an octed-stream are broken!

Something like:

enter image description here

Looks like the image started to render and then something happened...

It is happening on the big-sized images, but also on the thumbnail version of same image.

Any one has some hints as why this might occur?

UPDATE

The file which does not show up is a file with mime application/octet-stream So apparently I can retrieve the bytes from the file, but when they transmitted for PDF Rendering, the image does not appear...

Yet another update The issue seems to be related with the PDF Viewer. Was using a Linux based PDF Viewer (PDF Viewer 0.1.8) and specific images are broken. In all other PDF Viewers I could test everything works fine. Cannot close the issue as there is a bounty open :( Sorry that the bounty and question seems meaningless now, but you never know, someone might have an idea how to solve this even for PDF Viewer 0.1.8.

Orris answered 15/1, 2014 at 10:45 Comment(0)
H
1
<img src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQECWAJYAAD...">

works fine for me. Note the missing "e".

Hamburg answered 3/2, 2014 at 15:3 Comment(1)
That e is added by: <rendering:inlineJpeg />.Orris
F
-1

You can use rendering tag:

<rendering:inlineJpeg bytes="${your-image}" />

Make sure you decodeBase64() your image.

Fung answered 15/1, 2014 at 19:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.