-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using separate CSS-file to style different html-inputs #146
Comments
Hi @steam0 You can use the standard <html>
<head>
<link rel="stylesheet" href="style.css"/>
</head>
<body>
<div>
Hello World!
</div>
</body>
</html> You can also |
How do I provide a base directory? Any basic example? |
Same question: How to set a base directory? I am getting:
|
Just been working on this today. Use baseUrl here to define a base URL. |
when i use link as below (Using 1.0.2) in html I am getting following exception (Any help would be appreciated.) |
I am getting following exception if i use it as you mentioned. any help would be appreciated. |
what is baseURL here means ?? |
This library expects valid XML by default. This means all tags need a closing tag or be self-closing: <link href="..." />
<link href="..."></link> Either of the above are fine. If you have HTML that is not valid XML, you can convert it. The recommended way to do this is use Jsoup library to parse and convert. However, this is not working perfectly due to #445. It will be fixed in the next release. var jsoupDoc = Jsoup.parse(html);
var w3cDoc = new W3CDom().fromJsoup(jsoupDoc);
builder.withW3cDocument(w3cDoc, baseUrlMaybeNull); The base url may be null, if not the path is used as the base for resolving relative resources such as images, css stylesheets, etc. It must be a url such as |
Using separate resources can be achieved by providing your own FSStreamFactory:
Full code can be found in this example project |
Would be great if ClassPathStreamFactory could be added to this library! |
@daniel-shuy edit: Just realized we haven't enabled Issues on the other repo yet. Working on that. We're only recently transitioning to developing on the other project. see #921 |
@siegelzc didn't know this repository is no longer maintained, thanks! I'll create a PR. I just realized that its not a straight copy as the code depends on Spring Boot, but can be re-implemented in a way that doesn't depend on Spring Boot |
@siegelzc created a PR at openhtmltopdf#3 |
I was wondering if it is possible to use separate CSS-files to style multiple html-documents in the same way.
For now I have had to put the styling inside every HTML-document, but that is a waste since I will have between tens and houndreds of different documents which should all conform to the same stylesheet.
Any suggestions?
The text was updated successfully, but these errors were encountered: