I have some html which includes four pictures in a 2x2 row/col style: Picture of html output
I want to convert this into a PDF - trying this with the following lines of code:
options = {"enable-local-file-access": None}
config = pdfkit.configuration(wkhtmltopdf=path_wkhtmltopdf)
pdfkit.from_file(path_IN,path_OUT, configuration=config,options=options)
produces the following pdf output: Picture of pdf file output
Does anyone know how I can output a PDF that has the same look as the HTML code has?
Currently, I am generating my 2x2 structure by calling the following HTML code
<div class = "row_container">
<div class = "row">
<p class="caption">Figure 1: Real yield vs. Duration</p>
<img src="IL_fig1.png" width = "{width}" height = "{height}">
</div>
<div class = "row">
<p class="caption">Figure 3: Inflation</p>
<img src="IL_fig3.png" width = "{width}" height = "{height}">
</div>
</div>
<div class = "row_container">
<div class = "row">
<p class="caption">Figure 2: Break-even-inflation vs. Duration</p>
<!--<p>BEI, seasonal adjustment</p>-->
<img src="IL_fig2.png" width = "{width}" height = "{height}">
</div>
<div class = "row">
<p class="caption">Figure 4: Break-even-inflation, 10Y inflation-linked bonds</p>
<img src="IL_fig4.png" width = "{width}" height = "{height}">
</div>
</div>
Together with some CSS styling:
.row_container {
display: flex;
justify-content: space-between;
-webkit-box-pack: center;
overflow: hidden;
padding: 0px 3px 0px 3px;
}
.row {
-webkit-box-flex: 1;
-webkit-flex: 1;
/*flex: 1;*/
}
I have tried to scale the pictures, but this did not help either.:
I would like to have 2 pictures side by side in 2 rows as in the output from the HTML.
Appreciate the help.