1

I have a program that creates custom forms for my company. I have an issue where, when I print, chrome inserts page breaks to avoid splitting mid line. This causes all elements below that line to shift, ruining my positioning.

Is there any way I can know the height an element will have when it is printed?

Thanks

Loocid
  • 6,112
  • 1
  • 24
  • 42
  • Have you tried css's page-break-inside? https://stackoverflow.com/a/907719/3858736 – Matt Jul 13 '18 at 05:16
  • @MattG I want it to page break, and it does. The issue is when it does, it shuffles the positioning of all my elements. I need to know how things will be moved beforehand so I can compensate. – Loocid Jul 13 '18 at 06:01
  • You can use jQuery - `var result = $("#myDiv").height();` this code will provide you the height of your wrapper div. You will need to find the trigger for print page which you can override by this function - `var _print = window.print; window.print = function() { alert("Hi!"); // do stuff _print(); }` .It will be in px, if you want you can convert it to mm if required to match it with page size. I hope this will help you. – Pre'P Jul 13 '18 at 06:22

0 Answers0