Api

Loader, Progress, Metrics, Events & Slots

Build custom vue-pdf-export UI with loaders, progress state, generation metrics, component events and slots for PDF content and user-defined loading experiences.

Built-in loader

<Html2Pdf :show-loader="true" loader-text="Generating PDF..." />

Disable it:

<Html2Pdf :show-loader="false" />

Numeric progress

<Html2Pdf @progress="onProgress" />
function onProgress(value: number) {
  console.log(value)
}

This is generation-stage progress, not byte-level network progress.

Rich progress stages

<Html2Pdf @progress-stage="onProgressStage" />
import type { PdfProgressState } from 'vue-pdf-export'

function onProgressStage(state: PdfProgressState) {
  console.log(state.stage, state.progress)
}

Current stages:

idle
pagination
images
preparing
rendering
watermark
header
footer
metadata
serializing
complete
error

Generation metrics

Metrics are opt-in. When disabled, metrics collection does not add generation work.

<Html2Pdf
  :collect-metrics="true"
  @generation-complete="onGenerationComplete"
/>
import type { PdfGenerationCompletePayload } from 'vue-pdf-export'

function onGenerationComplete(payload: PdfGenerationCompletePayload) {
  console.log(payload.metrics)
}

A completed generation can expose total generation time, stage timings, per-page timings, render mode, page count, and generated Blob size.

interface GeneratePdfResult {
  pdf: jsPDF
  blob: Blob
  url: string
  metrics?: PdfGenerationMetrics
}

Use timing data for profiling and regression checks rather than as a hard real-time performance guarantee.

Custom loader

<Html2Pdf>
  <template #loader="{ progress, loading, stage, progressState }">
    <div v-if="loading">
      {{ stage }} - {{ progress }}%
    </div>
  </template>
</Html2Pdf>

Slot values:

ValueType
progressnumber
loadingboolean
stagePdfProgressStage
progressStatePdfProgressState

Events

<Html2Pdf
  @progress="onProgress"
  @progress-stage="onProgressStage"
  @generation-complete="onGenerationComplete"
  @startPagination="onStartPagination"
  @hasPaginated="onPaginated"
  @beforeDownload="onBeforeDownload"
  @hasDownloaded="onDownloaded"
  @closed="onClosed"
  @error="onError"
/>
EventPayloadDescription
progressnumberNumeric generation progress.
progressStage / @progress-stagePdfProgressStateNamed stage and progress.
generationComplete / @generation-completePdfGenerationCompletePayloadGeneration finished; includes opt-in metrics when enabled.
startPaginationnonePagination started.
hasPaginatednonePagination completed.
beforeDownloadBeforeDownloadPayloadEmitted before generation.
hasDownloadedBlobGenerated Blob is available.
closednonePreview/generation flow closed.
errorErrorGeneration or print error.

Slots

SlotRequiredDescription
pdf-contentyesHTML converted to PDF.
loadernoCustom loader with { progress, loading, stage, progressState }.
Copyright © 2026