Print.js icon indicating copy to clipboard operation
Print.js copied to clipboard

Printing HTML always overflow to next page

Open horkimsereirith opened this issue 1 year ago • 1 comments

Problem

When printing html with fixed width and height to match with A4 paper size, result seems to always overflow to next page.

<div
  id="paper"
  class="main"
  :style="{
    paddingLeft: '10px',
    paddingRight: '10px',
    paddingTop: '10px',
    paddingBottom: '10px',
    width: '29.7cm',
    width: '21cm',
    display: 'block',
    border: '1px solid blue',
    background: 'white'
  }"
>
  <h1 style="color:red">YOYO</h1>
  <div v-for="(i, index) in 15" :key="index">
    hiii {{ index + 1 }}
  </div>
  <slot />
</div>
this.$printJs({
  printable: 'paper',
  type: 'html',
  maxWidth: 'auto',
  style: '@media print { @page { size: A4 landscape } }',
  targetStyles: ['*']
})

Print result

image

horkimsereirith avatar Aug 23 '23 08:08 horkimsereirith

Have you managed to fix the issue? I'm struggling with a similar problem.

semvis123 avatar Oct 15 '23 13:10 semvis123