Comments (12)
Is this the expected output?
If so, I will clean up my code and do a PR later today.
from birt.
Hi,
I can reproduce this and I see this in the log:
Jul 07, 2021 7:50:08 AM org.eclipse.birt.report.engine.util.ResourceLocatorWrapper findResource
WARNING: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg== is not accessible.
ResourceLocatorWrapper.findResource is trying to parse and process the URI and it doesn't know what to do with the data protocol. It would need to be enhanced to do so. In order for you to work around this problem you would need to write the image to a file in the resource folder and then refer to that file in the img src.
from birt.
Hi Together,
I confirm the analysis of Steve. The reason is located at the "org.eclipse.birt.report.engine_4.8.0.v201806261756".
The image class hasn't a validation of a data-URL. Currently only absolut or relativ URLs are supported
or usage of the image-Item from the designer.
The api.impl.Image.class should be enhanced to implements an additional check of "data:image"-URL.
The data stream can be parsed with Base64.decodeBase64(vars["imageJpgBase64"]); to an byteArray[].
I have tested the decode with png, jpg and svg to (especially the svg needs explicit setting of "type expression" to image/svg+xml to get the correct result).
Have we somebody which is familiar with the emitter-plugin and could add the change?
Best regards
from birt.
I have veryfied my test report and the result looks perfect without any issue.
from birt.
"Have we somebody which is familiar with the emitter-plugin and could add the change?"
I don't think so - but maybe you can try this yourself?
Right now, it seems like Steve, Wim and myself are the only active developers - I am doing this as a side project and I think that Steve and Wim are in the same situation.
Any help is welcome!
Changing the emitter should be possible and not too complicated: I think it works like "download the image data to a byte array, then use the byte array". For data-URLs, instead of downloading the image data, the base64-content just has to be decoded.
It looks like changing org.eclipse.birt.report.engine.api.impl.Image and perhaps org.eclipse.birt.report.engine.util.FileUtil (isLocalResource) would suffice.
Perhaps I'll tackle this on a rainy autumn night...
Anyway, the workaround that you are describing should be possible with Javascript inside the report - at least if yor are not using images inside text paragraphs.
The idea would be to parse the HTML for img containing data URLs, save the data as a (temporary) file and replace the data URL with a file URL, then delete the temporary files as soon as the PDF is built.
But I don't think that even static images inside HTML dynamic text items will work in the PDF emitter (never actually tried this).
from birt.
i think overriding the ImageHandler in BIRT should help:
private void setupImageHandler(final HTMLRenderOption htmlOptions) {
htmlOptions.setImageHandler(new HTMLServerImageHandler() {
@OverRide
protected String handleImage(IImage image, Object context, String prefix, boolean needMap) {
String embeddedImage = Base64.getEncoder().encodeToString(image.getImageData());
return "data:" + image.getMimeType() + ";base64," + embeddedImage;
}
});
}
from birt.
I am now working on the chart tests and embedded images are supported. Can you supply a minimal report that shows the issue?
Maybe you need to add the image to the ROM. Here is a test to get the data, it should also be settable.
Here is a test with the two associated XML files with the report
from birt.
Hello there,
currently there are 2 issues. The original issues isn't based on the chart-object or the image-object.
The first issue is located on the "Text" and when it is used like HTML. The next step is to add a image-tage and use a soruce with base64-coding e.g.
The previe like HTML looks fine but the pdf-extract doesn't display the image - I will attache my example.
One solution could be to optimize the image.class so that the base64-stream will be written to the working directory.
The second issue is that the standard image-object at the designer doesn't accept SVG-Images like embeeded image
and the usage of SVG like shared sources make the image-object not longer changable and after report reloaed the report self ist crashed.
The BIRT-engine seems to convert in every case the SVG to a JPGE-image.
from birt.
Hello claesrosell,
yes, I confirm your result. The PDF-Dokument shows the correct images which are directly embeeded through the HTML-image-tag.
Thanks to your side, it looks great!
from birt.
@speckyspooky we have included the patch. Can you download the results later today and verify it is now working?
from birt.
https://github.com/eclipse/birt/actions/runs/1772942947
from birt.
Thanks for the verification specky, and three salutes to @claesrosell for the fix.
from birt.
Related Issues (20)
- ECMAScript 6, additional change to improve the "syntax highlighting" (based on 1574) HOT 1
- Excel, error on file opening when large column-width used at tables-/grid-definition HOT 1
- BIRT-designer/Nightly Build 4.16.0-202405152028, Report invisible & error on opening of reports - GraphicalEditorWithFlyoutPalette.getGraphicalViewer() throws NPE HOT 12
- Query text: enhance syntax highlighting to support more the sql standard data types HOT 2
- Sorting Column Bindings HOT 3
- Enhance the SQL-DataSet-Editor with a search option - see #1584 HOT 8
- BIRT 4.15 can't be used under Eclipse RAP HOT 4
- Can't generate Excel file: Could not auto-size column. Make sure the column was tracked prior to auto-sizing the column. HOT 1
- Getting NoSuchmethodError: "TTFReader.loadTTF" after updating BIRT runtime 4.10 to 4.15 HOT 1
- Errors in reports when upgrading BIRT Runtime from 4.10 to 4.15 HOT 2
- Expression Builder, Column Binding, sorting option - add additional sort option "Sort descending" HOT 1
- How can i fix this ReportServiceException HOT 2
- scripted data source 数据集只加载一次
- Out of memory error when creating a chart HOT 58
- Where is "null value" check box parameter in debug mode ??? 4.14 HOT 3
- 4.17 Releng HOT 1
- Use edge as default browser and use modern help HOT 3
- Show the DataView when a new report is created
- body/label/text-property is not localized in XLSX output HOT 4
- Excel, Apache POI 5.2.3 - PageMargin is changed to a new parameter list of methods HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from birt.