0
votes

I have html, to which I dynamically load content, and then convert to A4 pdf. Through converting I add margins: top: 3cm, right: 1cm, bottom: 2cm, left: 3cm. I have few elements in page where I using text-align:center. However after I convert it to pdf my centered content is not in center anymore. Is it possible to adjust centering for those side margins?

1
How you are converting it to pdf. which library? - Aagam Jain
@AagamJain nodejs "html-pdf" and rendering with handlebars. HTML itself is almost not touched html which you get when saving word document, just added handlebars markup for rendering data to it. Result is - it centered, but not as whole page, but if you mesure from margins - user86168

1 Answers

1
votes

Try this css codes for centering things

display: block;
margin-left: auto;
margin-right: auto