npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

Iโ€™ve always been into building performant and accessible sites, but lately Iโ€™ve been taking it extremely seriously. So much so that Iโ€™ve been building a tool to help me optimize and monitor the sites that I build to make sure that Iโ€™m making an attempt to offer the best experience to those who visit them. If youโ€™re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, ๐Ÿ‘‹, Iโ€™m Ryan Hefnerย  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If youโ€™re interested in other things Iโ€™m working on, follow me on Twitter or check out the open source projects Iโ€™ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soonโ€“ish.

Open Software & Tools

This site wouldnโ€™t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you ๐Ÿ™

ยฉ 2025 โ€“ย Pkg Stats / Ryan Hefner

vue-print-preview

v2.0.2

Published

๐Ÿ–จ๏ธ Professional Vue3 print preview component - Commercial license required

Downloads

19

Readme

Vue Print Preview

npm version License

๐Ÿ–จ๏ธ ๋ธŒ๋ผ์šฐ์ € ์ธ์‡„ ์—ฌ๋ฐฑ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” Vue 3 ์ธ์‡„ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ

Vue Print Preview๋Š” ์‹ค์ œ ์ธ์‡„๋ฌผ๊ณผ ์ •ํ™•ํžˆ ์ผ์น˜ํ•˜๋Š” ๋ฏธ๋ฆฌ๋ณด๊ธฐ๋ฅผ ์ œ๊ณตํ•˜์—ฌ ๋ธŒ๋ผ์šฐ์ €๋ณ„ ์ธ์‡„ ์—ฌ๋ฐฑ ๋ถˆ์ผ์น˜ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ“‹ ๋ฒ„์ „ ์ •๋ณด

v2.0.2 (ํ˜„์žฌ ๋ฒ„์ „)

  • ๐Ÿ”ง ์ •ํ™•ํ•œ ๋†’์ด ์ธก์ • ์˜ค๋ฅ˜ ํ•ด๊ฒฐ

v2.0.1

  • ๐Ÿ”ง ์Šคํƒ€์ผ ๊ด€๋ จ ์˜ค๋ฅ˜ ํ•ด๊ฒฐ, ํŽ˜์ด์ง€ ๋ Œ๋”๋ง ํƒ€์ด๋ฐ ๋ฌธ์ œ ํ•ด๊ฒฐ
  • ๐Ÿ”ง ์ •ํ™•ํ•œ ๋†’์ด ์ธก์ • ์‹คํŒจ ์˜ค๋ฅ˜ ํ•ด๊ฒฐ์ค‘

v2.0.0

์ฃผ์š” ๋ณ€๊ฒฝ์‚ฌํ•ญ (Breaking Changes):

  • ๐Ÿ”„ ์ปดํฌ๋„ŒํŠธ ์ด๋ฆ„ ๋ณ€๊ฒฝ: PrintPreviewScreen โ†’ <preview-pages>
  • ๐ŸŽจ Tailwind CSS ์™„์ „ ์ง€์›: iframe ์ธ์‡„์—์„œ Tailwind ํด๋ž˜์Šค ์ž๋™ ์ ์šฉ
  • ๐Ÿ“ ๋†’์ด ์ธก์ • ์•ˆ์ •ํ™”: getBoundingClientRect() ๊ธฐ๋ฐ˜ ์ •๋ฐ€ ๋†’์ด ๊ณ„์‚ฐ
  • ๐Ÿ”ง margin collapse ์ฒ˜๋ฆฌ: ๋ณต์žกํ•œ CSS ๋ ˆ์ด์•„์›ƒ์—์„œ ์ •ํ™•ํ•œ ํŽ˜์ด์ง€ ๋ถ„ํ• 

v1.0.0 - 2025๋…„ 8์›” ์ถœ์‹œ

  • ๐ŸŽฏ ๊ธฐ๋ณธ A4 ์ธ์‡„ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ๊ธฐ๋Šฅ
  • ๐Ÿ“„ ๋‹ค์–‘ํ•œ ์šฉ์ง€ ํฌ๊ธฐ ์ง€์› (A4, A3, B3, Letter)
  • ๐Ÿ“Š ๋‹ค๋‹จ ์ปฌ๋Ÿผ ๋ ˆ์ด์•„์›ƒ (1-3๋‹จ)
  • ๐ŸŽจ ํ—ค๋”/ํ‘ธํ„ฐ ์‹œ์Šคํ…œ

โœจ ์ฃผ์š” ๊ธฐ๋Šฅ

  • ๐ŸŽฏ ์ •ํ™•ํ•œ ์ธ์‡„ ๋ฏธ๋ฆฌ๋ณด๊ธฐ - ์‹ค์ œ ์ธ์‡„๋ฌผ๊ณผ 100% ์ผ์น˜ํ•˜๋Š” ํ™”๋ฉด ๋ฏธ๋ฆฌ๋ณด๊ธฐ
  • ๐ŸŽจ Tailwind CSS ์™„์ „ ์ง€์› - CDN ์ž๋™ ๋กœ๋”ฉ์œผ๋กœ ์Šคํƒ€์ผ ์™„๋ฒฝ ์žฌํ˜„ (v2.0.0)
  • ๐Ÿ“ ์ •๋ฐ€ ๋†’์ด ์ธก์ • - border, margin, box-shadow ํฌํ•จ ์ •ํ™•ํ•œ ํŽ˜์ด์ง€ ๋ถ„ํ•  (v2.0.0)
  • ๐Ÿ“„ ๋‹ค์–‘ํ•œ ์šฉ์ง€ ํฌ๊ธฐ - A4, A3, B3, Letter ํ”„๋ฆฌ์…‹ ๋ฐ ์ปค์Šคํ…€ ํฌ๊ธฐ ์ง€์›
  • ๐Ÿ“Š ๋‹ค๋‹จ ์ปฌ๋Ÿผ ๋ ˆ์ด์•„์›ƒ - 1-3๋‹จ ์ปฌ๋Ÿผ ์ž๋™ ๋ถ„ํ•  ๋ฐ ๊ท ๋“ฑ ๋ฐฐ์น˜
  • ๐Ÿ“‘ ์ž๋™ ํŽ˜์ด์ง€ ๋ถ„ํ•  - DOM ๋†’์ด ๊ธฐ๋ฐ˜ ์ง€๋Šฅํ˜• ํŽ˜์ด์ง€ ๋‚˜๋ˆ„๊ธฐ
  • ๐ŸŽจ ํ—ค๋”/ํ‘ธํ„ฐ ์‹œ์Šคํ…œ - ํŽ˜์ด์ง€๋ณ„ ํ—ค๋”, ์ƒ๋‹จ, ํ‘ธํ„ฐ ํ…œํ”Œ๋ฆฟ ์ง€์›
  • ๐Ÿ“ฑ ๋ฐ˜์‘ํ˜• ์Šค์ผ€์ผ๋ง - ์ปจํ…Œ์ด๋„ˆ ํฌ๊ธฐ์— ๋”ฐ๋ฅธ ์‹ค์‹œ๊ฐ„ ํฌ๊ธฐ ์กฐ์ •
  • ๐Ÿ”ง TypeScript ์ง€์› - ์™„์ „ํ•œ ํƒ€์ž… ์•ˆ์ „์„ฑ ๋ณด์žฅ

๐Ÿ“ฆ ์„ค์น˜

npm install vue-print-preview

๐Ÿš€ ๋น ๋ฅธ ์‹œ์ž‘

๊ธฐ๋ณธ ์‚ฌ์šฉ๋ฒ•

<template>
  <preview-pages 
    preset="A4"
    :content="htmlContent"
  />
</template>

<script setup>
import { PreviewPages } from 'vue-print-preview'

const htmlContent = `
  <h1>์ œ๋ชฉ</h1>
  <p>์ธ์‡„ํ•  ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค.</p>
`
</script>

์ปค์Šคํ…€ ์—ฌ๋ฐฑ ์„ค์ •

<template>
  <preview-pages 
    preset="A4"
    :content="htmlContent"
    :custom-margins="{ 
      top: 25, 
      right: 20, 
      bottom: 25, 
      left: 20,
      columns: 2,
      columnGap: 15
    }"
  />
</template>

์™„์ „ ์ปค์Šคํ…€ ์šฉ์ง€ ์„ค์ •

<template>
  <preview-pages 
    :paper-config="{
      width: 200,
      height: 280,
      margins: { top: 15, right: 10, bottom: 15, left: 10 },
      columns: 2,
      columnGap: 12,
      name: 'Custom Size'
    }"
    :content="htmlContent"
  />
</template>

ํ—ค๋”/ํ‘ธํ„ฐ ์‚ฌ์šฉ

<template>
  <preview-pages 
    preset="A4"
    :content="htmlContent"
    :header="headerHTML"
    :page-top="pageTopHTML"
    :footer="footerHTML"
  />
</template>

<script setup>
const headerHTML = `
  <div style="text-align: center; border-bottom: 2px solid #333;">
    <h1>๋ฌธ์„œ ์ œ๋ชฉ</h1>
  </div>
`

const pageTopHTML = `
  <div style="text-align: right;">
    ํŽ˜์ด์ง€ {{pageNumber}}/{{totalPages}}
  </div>
`

const footerHTML = `
  <div style="text-align: center;">
    ยฉ 2025 My Company
  </div>
`
</script>

๐Ÿ“– API ๋ฌธ์„œ

Props

| ์†์„ฑ | ํƒ€์ž… | ๊ธฐ๋ณธ๊ฐ’ | ์„ค๋ช… | |------|------|--------|------| | preset | 'A4' \| 'A3' \| 'B3' \| 'LETTER' | 'A4' | ํ‘œ์ค€ ์šฉ์ง€ ํฌ๊ธฐ ํ”„๋ฆฌ์…‹ | | paperConfig | PaperConfig | - | ์™„์ „ ์ปค์Šคํ…€ ์šฉ์ง€ ์„ค์ • | | customMargins | CustomMargins | - | ํ”„๋ฆฌ์…‹ ๊ธฐ๋ฐ˜ ๋ถ€๋ถ„ ์ˆ˜์ • | | content | string | - | ์ธ์‡„ํ•  HTML ์ฝ˜ํ…์ธ  | | header | string | - | ์ฒซ ํŽ˜์ด์ง€ ํ—ค๋” HTML | | pageTop | string | - | ๋ชจ๋“  ํŽ˜์ด์ง€ ์ƒ๋‹จ HTML | | footer | string | - | ๋ชจ๋“  ํŽ˜์ด์ง€ ํ•˜๋‹จ HTML |

ํƒ€์ž… ์ •์˜

interface PaperConfig {
  width: number        // mm ๋‹จ์œ„
  height: number       // mm ๋‹จ์œ„
  margins: {
    top: number        // mm ๋‹จ์œ„
    right: number      // mm ๋‹จ์œ„
    bottom: number     // mm ๋‹จ์œ„
    left: number       // mm ๋‹จ์œ„
  }
  columns?: number     // ์ปฌ๋Ÿผ ์ˆ˜ (1-3)
  columnGap?: number   // mm ๋‹จ์œ„
  name?: string        // ์šฉ์ง€ ์ด๋ฆ„
}

interface CustomMargins {
  top?: number         // mm ๋‹จ์œ„
  right?: number       // mm ๋‹จ์œ„
  bottom?: number      // mm ๋‹จ์œ„
  left?: number        // mm ๋‹จ์œ„
  columns?: number     // ์ปฌ๋Ÿผ ์ˆ˜
  columnGap?: number   // mm ๋‹จ์œ„
}

๐Ÿ” ๊ณ ๊ธ‰ ์‚ฌ์šฉ๋ฒ•

ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋ฐฉ์‹ ์ธ์‡„

<template>
  <preview-pages 
    ref="printRef"
    preset="A4"
    :content="content"
  />
  <button @click="handlePrint">์ธ์‡„ํ•˜๊ธฐ</button>
</template>

<script setup>
import { ref } from 'vue'

const printRef = ref()

const handlePrint = () => {
  if (printRef.value) {
    printRef.value.printPreview()
  }
}
</script>

๋‹ค๋‹จ ์ปฌ๋Ÿผ ๋ ˆ์ด์•„์›ƒ

<template>
  <preview-pages 
    preset="A4"
    :custom-margins="{ 
      columns: 3,      // 3๋‹จ ์ปฌ๋Ÿผ
      columnGap: 8     // 8mm ๊ฐ„๊ฒฉ
    }"
    :content="columnContent"
  />
</template>

๐ŸŽจ ์Šคํƒ€์ผ๋ง

๋ชจ๋“  ํฌ๊ธฐ์™€ ์—ฌ๋ฐฑ์€ mm ๋‹จ์œ„๋กœ ํ†ต์ผ๋˜์–ด ์žˆ์–ด ์ธ์‡„๋ฌผ๊ณผ ์ •ํ™•ํžˆ ์ผ์น˜ํ•ฉ๋‹ˆ๋‹ค.

/* ๊ธ€๋กœ๋ฒŒ CSS์—์„œ ์‚ฌ์šฉ์ž ์ •์˜ ์Šคํƒ€์ผ */
.print-page-wrapper {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.print-page {
  font-family: 'Noto Sans KR', sans-serif;
}

๐Ÿ“‹ ์‚ฌ์šฉ ์˜ˆ์‹œ

์‹œํ—˜์ง€ ๋ ˆ์ด์•„์›ƒ

<template>
  <preview-pages 
    preset="A4"
    :content="examContent"
    :header="examHeader"
    :footer="examFooter"
    :custom-margins="{ 
      top: 30, 
      columns: 2,
      columnGap: 15 
    }"
  />
</template>

<script setup>
const examHeader = `
  <div style="text-align: center; border-bottom: 2px solid #000;">
    <h1>2025ํ•™๋…„๋„ ๋ชจ์˜์‹œํ—˜</h1>
    <h2>์ˆ˜ํ•™ ์˜์—ญ</h2>
  </div>
`

const examFooter = `
  <div style="text-align: right; font-size: 10pt;">
    ํŽ˜์ด์ง€ {{pageNumber}} / {{totalPages}}
  </div>
`
</script>

๐Ÿ’ก ํŒ๊ณผ ์š”๋ น

  1. mm ๋‹จ์œ„ ์‚ฌ์šฉ: ๋ชจ๋“  ํฌ๊ธฐ๋Š” mm ๋‹จ์œ„๋กœ ์„ค์ •ํ•˜์—ฌ ์ธ์‡„ ์ •ํ™•๋„๋ฅผ ๋ณด์žฅํ•ฉ๋‹ˆ๋‹ค.
  2. ํ—ค๋”/ํ‘ธํ„ฐ ํ…œํ”Œ๋ฆฟ: {{pageNumber}}์™€ {{totalPages}} ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  3. ์ปฌ๋Ÿผ ์ตœ์ ํ™”: 1-3๋‹จ ์ปฌ๋Ÿผ์„ ์ง€์›ํ•˜๋ฉฐ, ์ปฌ๋Ÿผ ๊ฐ„๊ฒฉ์€ 8-15mm๊ฐ€ ๊ถŒ์žฅ๋ฉ๋‹ˆ๋‹ค.
  4. ๋ฐ˜์‘ํ˜• ๋ฏธ๋ฆฌ๋ณด๊ธฐ: ์ปจํ…Œ์ด๋„ˆ ํฌ๊ธฐ์— ๋”ฐ๋ผ ์ž๋™์œผ๋กœ ์Šค์ผ€์ผ์ด ์กฐ์ •๋ฉ๋‹ˆ๋‹ค.

๐Ÿ› ๏ธ ์‹œ์Šคํ…œ ์š”๊ตฌ์‚ฌํ•ญ

  • Vue: 3.5.18+
  • TypeScript: 5.7.2+ (์„ ํƒ์‚ฌํ•ญ)
  • ๋ธŒ๋ผ์šฐ์ €: Chrome 90+, Firefox 88+, Safari 14+

๐Ÿ“„ ๋ผ์ด์„ผ์Šค

์ด ์†Œํ”„ํŠธ์›จ์–ด๋Š” ๋…์  ๋ผ์ด์„ผ์Šค ํ•˜์— ๋ฐฐํฌ๋ฉ๋‹ˆ๋‹ค. ์ƒ์—…์  ์‚ฌ์šฉ ๋ฐ ์žฌ๋ฐฐํฌ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๊ฐœ๋ฐœ์ž์—๊ฒŒ ๋ฌธ์˜ํ•˜์„ธ์š”.

๐Ÿ‘จโ€๐Ÿ’ป ๊ฐœ๋ฐœ์ž

hoonee-math


Vue Print Preview๋Š” ์ •ํ™•ํ•œ ์ธ์‡„ ๋ฏธ๋ฆฌ๋ณด๊ธฐ๋ฅผ ํ†ตํ•ด ๋” ๋‚˜์€ ์‚ฌ์šฉ์ž ๊ฒฝํ—˜์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

๐Ÿ“– ๋ฌธ์„œ โ€ข ๐Ÿ› ์ด์Šˆ ์‹ ๊ณ  โ€ข ๐Ÿ’ผ ํฌํŠธํด๋ฆฌ์˜ค