No styles applied using Play! 2.0 PDF module - java

I recently installed the PDF module for Play! 2.0 and was able to wire it up to render a PDF without much difficulty. However, it looks like it's not loading my stylesheet, since no styles get applied to the PDF.
I've tried referencing my stylesheet using the classpath:
<link rel="stylesheet" type="text/css" href="/public/css/pdf.css" media="screen" />
I've also tried referencing it using #routes:
<link rel="stylesheet" type="text/css" href="#routes.Assets.at("css/pdf.css")" media="screen" />
In an attempt to keep it simple, I've included only one style in my stylesheet:
td {
color: blue;
}
If I render as HTML, the text in my table is blue, but if I render as PDF, it's all black.
If this is a known issue, I don't see it anywhere. I'm under the impression this should work, so it seems like I must be missing something or doing something wrong. Can anyone help?
I've also reported the issue here.

I am not sure if this is the only issue, but I wrote about one issue in my book when I wrote about the PDF module for play 1.x.
The CSS you are using (and the default for Play when first generated) is to use media="screen". A PDF is classified as print. You therefore need to set media="print".
media="print"
So it would be
<link rel="stylesheet" type="text/css" href="/public/css/pdf.css" media="print" />

Related

Css wont load JSp

I'm opening this because I have an issue with my css in my project he won't load I don't know why I try many things. I'm in JEE Maven project I run this on apache server 9 everything work just css won't charge Sorry if I made typos still learning English.
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" >
<link href="../css/listerEmployer.css" rel="stylesheet">
</head>
It loading in preview but not on the page I don't know why I really need some help.

Spring Boot cant serve css file with Thymeleaf View

I am making an app with Spring Boot.
I have a Thymeleaf view chat.html in resources/templates/chat.html I include style.css stylesheet in it.
When I load the chat.html in browser only html shows without any stylesheet.
Here is chat.html
<html xmlns:th="http://www.thymeleaf.org">
<head>
<link href="styles/style.css" rel="stylesheet">
<title>Chat Web App</title>
</head>
...some irrelevant html ...
<body>
</body>
</html>
I have put the style.css in resources/static/styles/style.css as per several other answers for same problem but no bueno. Perhaps some additional configuration need to be made or i am simply making a dumb typo.
The issue was actually in my CSS file :) . Apparently i had selectors for classes that werent present in the html. After removing them the solution proposed in the comments worked fine!

How to add CSS to an eclipse HTML file

My assignment is to create a class in java and add tags through comments to make it look just like this http://docs.oracle.com/javase/7/docs/api/. My problem is though that the CSS doesn't stay with the html file. It comes out without the CSS. I've tried doing
<style>href="http://docs.oracle.com/javase/7/docs/api/stylesheet.css"</style>
but I can't get the CSS to stick. What am I doing wrong?
This is the way you link css files in html
<link href="http://docs.oracle.com/javase/7/docs/api/stylesheet.css" rel="stylesheet" type="text/css">
Did you add the lines as ususer2812693 mentioned. Just check whether, the css is file loaded into the browser using firebug. And also the css classes and ID s are correct with html elements' classes and ID s. Or else, first try to download the css file which you refer and, try to call it locally from your html page.

wicket 1.5 + error-page + cannot find the related path to css resources

I have the next problem with wicket and standard error handling:
all the css files are stored as java resources, near the html pages.
It's working fine. But, when I added the 404 error handling in the web.xml so that any not-found-url is treating as redirect to my PageNotFound.class - the paths to css in this page are broken. it's writes it as
<wicket:link>
<link rel="stylesheet" type="text/css" href="../../wicket/resource/com.web.common.PageNotFound/css/common.css"/>
</wicket:link>
instead of
<wicket:link>
<link rel="stylesheet" type="text/css" href="wicket/resource/com.web.common.PageNotFound/css/common.css"/>
</wicket:link>
(which is working fine, and appeared if I point directly to this PageNotFound page)
So the questions is - why only when error is handled it adds additional useless "../../" to css path?
I did all as it is described here (HTTP Error pages part): adding custom error pages using wicket
Have a look at https://issues.apache.org/jira/browse/WICKET-3602. This might be the cause of your problem.

How to apply custom styles to a jasper html report

How does one apply custom CSS to a HTML report generated using Jasper. I need to include this report as an iFrame into a GWT window.
You can simply include a link tag in your GWT html file like so:
<link type="text/css" rel="stylesheet" href="myJasperStyles.css">
The CSS file should explicitly refer to Jasper-related HTML tags to ensure the CSS won't affect your GWT elements.

Categories