Ich erstelle eine Datei pdf aus HTML-Vorlage mit Spring Boot, fliegende Untertasse, Thymoleaf. Aber das Bild wird nicht in meiner Datei angezeigt.Bild nicht in PDF-Vorlage mit Spring Boot, fliegende Untertasse und Thymoleaf
Projektstruktur:
Code html:
<div class="col-xs-6 invoice-col-2">
<img src="../static/images/mastercard.png" alt="mastercard"></img>
</div>
Wenn ich img-Tag zu ändern:
<img src="../static/images/mastercard.png" alt="mastercard" th:src="@{static/images/mastercard.png}"></img>
Wh en I PDF-Datei zu erstellen, erhalte ich eine Fehlermeldung:
org.thymeleaf.exceptions.TemplateProcessingException: Link base "static/images/mastercard.png" cannot be context relative (/) or page relative unless you implement the org.thymeleaf.context.IWebContext interface (context is of class: org.thymeleaf.context.Context)
Versuchen Sie mit absoluten Pfad oder make 'src ="/images/mastercard.png "' in 'img'tag –
danke für die Antwort. Ich versuche, src = "/ images/mastercard.png" im img-Tag zu ändern, aber das Bild wird nicht angezeigt. Ich verwende in img-Tag und es wird angezeigt. Ich habe es gerade getan. :)) – dinhbao10t4