geonetwork / geonetwork/core-geonetwork

Bug: Generating pdf using formatter from search results page results in blank pdf

Open
#7,983 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
521
Forks
514
Avg merge
6d 13h
Merged PRs (30d)
19

Description

**Describe the bug**
To get around the fact that it does not seem possible at the moment to generate a multi-lingual pdf from the search page (either labels or metadata) I have been trying to get the formatter approach to work as mentioned in [web/src/main/webapp/xslt/services/pdf/portal-present-fop.xsl](https://github.com/geonetwork/core-geonetwork/blob/4.2.x/web/src/main/webapp/xslt/services/pdf/portal-present-fop.xsl). I have a working formatter that generates results correctly when called from a browser using (eg) `http://localhost/geonetwork/api/records/UUID/formatters/myformatter?language=wel&output=pdf` but I am struggling to get this to work as the `src` in
```

```
I have tried simply assigning the URL to `src`, and building it using `concat` statements but nothing makes any difference. When I print out the value of `src` as an `xsl:message` it is correct, and the code generates a pdf, but it is blank. I have tried debugging this in debug mode and in the web console in my browser but I can't see any errors. My record is public so there should be no authentication problems.

**Additional context**
Related issues, to do with generating multi-lingual pdfs from the search page include https://github.com/geonetwork/core-geonetwork/issues/6630 but that just refers to the language of the labels.
I have also tried to get around these problems by reverting to the traditional non-formatter approach in https://github.com/geonetwork/core-geonetwork/blob/4.2.x/web/src/main/webapp/xslt/services/pdf/portal-present-fop.xsl and adapting https://github.com/geonetwork/core-geonetwork/blob/4.2.x/web/src/main/webapp/xslt/services/pdf/metadata-fop.xsl. I can hard-code the labels to a certain extent but I'm stuck with the fact that elements like `resourceAbstractObject` only include the default value from the index and not the translations.

Any help with either approach would be much appreciated!

Contributor guide

Open the contributing guide

Research direction

Start with web/src/main/webapp/xslt/services/pdf/portal-present-fop.xsl and compare the formatter URL that works in a browser with the fox:external-document src used there. Investigate why the generated PDF is blank despite the src value being correct, using the formatter endpoint and the traditional metadata-fop.xsl approach as context. Done means the search-results PDF contains the expected record content.

Written by the indexing model from the issue text.

Assessment

Tech stack
xml
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.