danfickle / danfickle/openhtmltopdf

Determine the file type based on the HTTP Content-Type header

Open
#667 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

I am trying to load this (svg) file: https://app.metronome.nl/api/document-view/e1bcaee7-8616-499e-9c2e-f6f5161f6436. In a browser it displays fine. However openpdftohtml emits the following warnings:

```
com.openhtmltopdf.load WARNING:: Unrecognized image format for: https://app.metronome.nl/api/document-view/e1bcaee7-8616-499e-9c2e-f6f5161f6436
com.openhtmltopdf.exception WARNING:: Can't read image file; unexpected problem for URI 'https://app.metronome.nl/api/document-view/e1bcaee7-8616-499e-9c2e-f6f5161f6436'
```
After some experimentation I discovered that appending an `.svg` extension fixed things. Looks like the URL needs to end with `.svg` to be recognized properly...

Suggestion: determine the file type based on the HTTP Content-Type header.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.