-
Notifications
You must be signed in to change notification settings - Fork 101
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
I moved the css into the public directory but the same behaviour continues. #47
Comments
Can you make the link relative to your CCI.vue? Like so, |
try "/print.css" |
VueHtmlToPaper opens a new window with its own style tag. So when you pass a CDN it works, if u pass a local file it does not because it tries to access the resource in your web server but in the wrong URL. Let's see how the page looks when we use a CDN and a local CSS file. CDN<html>
<head>
<link rel="style" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
</head>
<body>
</body>
</html> Local CSS fileAnd let's say you are calling the print function from <html>
<head>
<link rel="style" href="./myPrint.css">
</head>
<body>
</body>
</html> This will try to open Solution
Sample Optionimport VueHtmlToPaper from 'vue-html-to-paper'
/* This will change according to your server */
let basePath= 'http://localhost:8080';
const options = {
name: '_blank',
specs: [
'fullscreen=yes',
'titlebar=yes',
'scrollbars=no'
],
styles: [
'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css',
`${basePath}/myPrint.css`
]
}
Vue.use(VueHtmlToPaper, options) Also, the simplest way to access root-relative path is to use |
Thanks @Bopsi this actually make sense. Would mind trying this @Zanndorin? Thanks. |
@jofftiquez I have tried the basePath thing, but it didn't change anything. I tried with I'll try again later, might try uploading it to a S3 bucket and getting it from there to get it to work... 🤔 But the CSS file I provided should work as I expect? I.e. make the default print settings "labelsized"?
|
I don't seem to get this to work at all, maybe it is my browser... (Tried with a css from S3 bucket and locally, doesn't seem to change anything) :) |
Hi |
maybe just, put your css file in the public, and you can set script options styles of property path. just likes: use this css file: note: do not use pathname public, just use your css file in the directory |
I've spent a day on this, only thing that worked was uploading it to a webserver and using a regular https. |
I moved the css into the public directory but the same behaviour continues.
Originally posted by @luisluft in #46 (comment)
The text was updated successfully, but these errors were encountered: