Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Media Elements

PdfViewer

Displays a PDF in the page using the bundled pdf.js.

sc.PdfViewer('manual.pdf')
sc.PdfViewer('https://example.com/report.pdf')
ArgumentTypeMeaning
srcstr | bytesA local path, a URL, or PDF bytes
pages_to_rendersequence of intsPages to draw; empty means all
heightsize keywordDefault 500
max_heightintCap the viewer height
visiblebool | Property | 'auto'Default 'auto'

Properties: src, visible.

src may be:

  • a filesystem path;
  • an HTTP(S) URL;
  • raw PDF bytes.

pages_to_render limits which pages are drawn. This is useful for a large document where only a few pages matter.

If only max_height is given, the height becomes 'content' and the viewer grows up to that cap. An empty src hides the viewer when visible='auto'.