Open iamgokul opened 7 years ago
You can use inline style (eg <p style="line-height: 90%; font-family: Helvetica">Hello world</p>
), or a style tag in the <head>
, whichever you prefer. You have full CSS support.
Can we add watermark to this pdf?
I suggest you try a CSS background, either on a containing element or
@page {
background: url('./watermark.png')
}
I'm able to adjust much of the style - font-family, font-size, background-color, etc, but for some reason I'm unable touse pdf-handlebars to:
Float a div to the right (maybe because float is a reserved word in javascript), and
Use CSS grid.
Is there something I'm missing? A template of this is at [https://codepen.io/capndavet/pen/eMmdJV], which works fine but doesn't use handelbars-pdf. Relevant code is below.
<style>
html, body {
font-family: "Open Sans", Arial, sans-serif;
}
.title-main {
text-align: center;
}
.grid {
display: grid;
grid-template-columns: 300px 1fr 1fr;
font-size: 24px;
text-align: left;
}
.grid-title {
font-weight: bold;
}
.grid-content {
grid-column: 2/4;
}
.float-right {
float: right;
}
</head>
<body>
<h1 class="title-main">Pull Sheet</h1>
<p>
<span>Feb 17th, 1977, 2:23am</span>
<span class="float-right">Red Desk Lane: 1</span>
</p>
<div class="grid">
<p class="grid-title">Primary Property:</p>
<p class="grid-content">123456</p>
<p class="grid-title">Additional Properties:</p>
<p class="grid-content">
<span>123456<br></span>
<span>567890<br></span>
</p>
</div>
</body>
This is strange to me. We've successfully used Bootstrap 3 with this and that's definitely using float. Have you tried with !important? I'm not the sharpest CSS guru out there, but that seems to make silly things be less silly sometimes.
Does your package rely on Phantom.js, perchance? I found this discussion about Phantom.js's inability to deal with css grid and some other style elements. I'll try bootstrap!
Also, any advice on how to call bootstrap? It doesn't seem to be working when I include a ref to local bootsrap js and css files from the template head!
Yes, it's using Phantom to render. I'll push an update after the weekend sometime that will make it a lot easier to include local files. A little makeover is due anyway.
Can we change the properties of the pdf like linespacing, font-family, etc... I tried changing the font-family in default options. But it didnt work out.
Thanks in advance.