Pricing
JavaScript library documentation

Real3D Flipbook JS

Real3D Flipbook JS turns a PDF or a set of images into a flipbook on any web page or web app. It is plain JavaScript with no dependencies. This guide covers installing, activating your license, creating flipbooks, every option, interactive pages and the JavaScript API.

What's in the zip

FolderWhat it is
build/The flipbook: js/, css/ and assets/. Upload this folder to your site.
examples/Ready-to-use HTML pages that load the files from build/. Copy one as a starting point.
changelog.txtWhat changed in each version.

The CodeCanyon download also contains src/, the same scripts unminified.

Activate your license

The flipbook needs an active license on each domain where it runs. You can test on localhost without activating.

Bought on real3dflipbook.com

  1. Open verify.real3dflipbook.net/js.
  2. Enter your license key. It starts with sk_ and is in your purchase email and your account.
  3. Enter your domain, for example example.com, and click Activate. www.example.com and example.com count as one domain.

Bought on CodeCanyon

  1. Open verify.real3dflipbook.net and sign in with your Envato account.
  2. Enter your domain and click Activate.

To move a license to another domain, click Deactivate next to the old domain first, then activate the new one.

Install

  1. Upload the contents of build (js, css, assets) to a folder on your site, for example /flipbook/.
  2. Add the stylesheet and the script to your page:
    <link rel="stylesheet" href="/flipbook/css/flipbook.min.css">
    <script src="/flipbook/js/flipbook.min.js"></script>
  3. Add an element for the flipbook and create it with new FlipBook(element, options) (next sections).
Keep the files of build/js together. flipbook.min.js loads the other files (the view modes, the PDF reader, the 3D engine) from the same folder only when they are needed.

Point the page-turn sound at your folder with the assets option: assets: { flipMp3: "/flipbook/assets/mp3/turnPage.mp3" }.

jQuery is not needed. If your site uses it, $("#container").flipBook(options) works too.

PDF flipbook

<div id="container" style="height:600px"></div>

<script>
  document.addEventListener("DOMContentLoaded", function () {
    new FlipBook(document.getElementById("container"), {
      pdfUrl: "/files/brochure.pdf",
      name: "Brochure 2026"
    });
  });
</script>

The flipbook fills the container, so give the container a height (or let responsiveContainer size it, which is on by default). Pages load as they are read, links in the PDF work, and the text can be searched and selected.

PDF flipbook on a page with the default toolbar
A PDF flipbook with the default options.

The PDF must be on the same domain as the page, or on a server that allows cross-origin requests (see Troubleshooting).

Image flipbook

new FlipBook(document.getElementById("container"), {
  pages: [
    { src: "book/1.jpg", thumb: "book/thumb1.jpg", title: "Cover" },
    { src: "book/2.jpg", thumb: "book/thumb2.jpg" },
    { src: "book/3.jpg", thumb: "book/thumb3.jpg", title: "Chapter 1" }
  ]
});

Each page takes:

KeyWhat it does
srcThe page image (JPG or WebP).
thumbA small version for thumbnails. It is also shown while src loads.
srcSmall, srcLargeOptional smaller and larger versions. srcSmall is used for pages loaded ahead and when the page is small on screen; srcLarge when the reader zooms in past the size of src.
titleAdds the page to the table of contents.
jsonText and links of the page, as made by the PDF to Image Converter, so search and links work in an image flipbook.
items, htmlContentLinks, hotspots, video and other content on the page (see Page items).

Update

  1. Download the latest version: from the link in your purchase email or your account (real3dflipbook.com), or from Downloads on CodeCanyon.
  2. Replace the js, css and assets folders on your site with the new ones from build.

Your license stays active. Browsers cache scripts, so add a version to the URLs if readers might keep the old files, for example flipbook.min.js?v=5.9.

View modes

Set viewMode:

ValueHow pages move
webgl (default)Real 3D: pages bend with light and shadow.
3dCSS 3D page turn.
2dFlat page turn.
swipePages slide sideways, like a phone gallery.
scrollPages scroll top to bottom, like a PDF viewer.
simpleNo animation; the book fades between pages.
The same book in webgl and scroll view mode
The same PDF in webgl and scroll mode.

singlePageMode: true shows one page at a time instead of spreads. pageFlipDuration sets the turn speed in seconds (default 1).

Toolbar layouts

Set layout to one of ten toolbar layouts:

ValueLayoutValueLayout
1Bottom bar (default)6Minimal
2Top corners7Player
3Top bar8Pill
4Top pill9Left rail
5Bottom corners10Right rail
The ten toolbar layouts
Layouts 1 to 10.

On phones the rail layouts switch to the Pill. Other toolbar options: progressBar: { enabled: true } adds a progress bar, menuAutoHide: true hides the toolbar on phones and tablets after a few seconds (a tap shows it again), hideMenu: true hides it completely, and iconSet picks "fontawesome" (solid) or "lucide" (outline) icons.

Skins and colors

Set skin to "light", "dark" or "gradient", and add glass: true for frosted toolbars and panels on the light and dark skins.

Light, dark, gradient, glass light and glass dark skins
light, dark, gradient, light with glass, dark with glass.

Fine-tune colors with backgroundColor (or backgroundImage, backgroundPattern, backgroundTransparent), accentColor, skinColor and skinBackground for the toolbar, btnColor, btnBackground, btnSize, btnRadius for buttons, floatingBtn* for buttons over the book, and arrow* for the side arrows. All are in the options table.

Add a dark mode switch to the More menu with btnDarkMode: { enabled: true }.

Toolbar buttons

Every button has its own option object. Turn a button off, rename it, move it, or put it in the More menu:

new FlipBook(el, {
  pdfUrl: "/files/brochure.pdf",
  btnPrint: { enabled: false },
  btnDownloadPdf: { title: "Get the PDF", url: "/files/brochure-print.pdf" },
  btnShare: { hAlign: "right" },
  btnSound: { toolsMenu: true }
});
ButtonDefaultButtonDefault
currentPageonbtnBookmarkon
btnFirst, btnLaston, in MorebtnAutoplayon
btnPrev, btnNextonbtnShareon
btnZoomIn, btnZoomOutonbtnPrinton, in More
btnThumbsonbtnDownloadPdfon, in More
btnToconbtnDownloadPageson, in More
btnSearchonbtnSoundon, in More
btnSingleon, in MorebtnDarkModeoff
btnExpand (fullscreen)onbtnRotateLeft, btnRotateRightoff

Button keys: enabled, title (tooltip), hAlign (left, center, right), vAlign (top, bottom), toolsMenu (in the More menu). btnOrder is the list of button names in display order. Positions apply to the Bottom bar layout; the other layouts place buttons themselves.

Share targets are whatsapp, twitter, facebook, pinterest, email, linkedin, reddit, digg and copyLink, each with enabled. shareUrl, shareTitle and shareImage set what is shared.

On narrow embeds the toolbar moves buttons that don't fit into the More menu (below compactBreakpoint, 768 px).

Table of contents

A PDF with an outline gets its table of contents automatically. To set your own:

tableOfContent: [
  { title: "Introduction", page: 3 },
  { title: "Products", page: 6, items: [
    { title: "Sofas", page: 6 },
    { title: "Tables", page: 10 }
  ]}
]

A title on a page in pages also adds it. Thumbnails, contents and search open as panels next to the book:

Thumbnails panel
Thumbnails (thumbnailsOnStart)
Table of contents panel
Contents (contentOnStart)
Search panel with results
Search (searchOnStart: "word")

Phones and tablets

On phones the flipbook shows one page at a time, side arrows are off and the toolbar is compact. Anything inside mobile overrides the options on phones and tablets:

mobile: {
  viewMode: "swipe",
  pdfUrl: "/files/brochure-small.pdf",
  btnPrint: { enabled: false }
}
Flipbook on a phone
One page at a time on a phone.

Covers, right to left, deep links

  • Covers: cover: false starts the book with a spread instead of a single front cover; backCover does the same for the end. hardCover: true gives the book stiff covers (with hardCoverColor).
  • Start page: startPage. pageNumberOffset shifts the numbers shown when the printed numbering starts later.
  • Right to left: rightToLeft: true for Arabic, Hebrew and manga.
  • Deep linking: deeplinkingEnabled: true adds the page to the URL (#page2), so readers can share a page. With several books on one page, give each a deeplinkingPrefix, for example "book1_": the link #book1_5 opens that book on page 5, and opens its lightbox if it is a lightbox book.
  • Autoplay: autoplayOnStart, autoplayInterval (ms), autoplayLoop.
  • Sound: sound turns the page-turn sound on or off; backgroundMusic takes an mp3 URL.
  • Logo: logoImg, logoUrl, logoCSS.
  • Part of a PDF: pageRangeStart and pageRangeEnd.
  • Zoom: zoomMin (initial zoom), zoomStep, zoomReset (reset zoom after a page turn), doubleClickZoomDisabled.

Page items

Add items to a page to put links, media and hotspots on it. Positions are pixels on a page 1000 px tall; the width follows the page's proportions. For a PDF flipbook, list only the pages that have items:

new FlipBook(el, {
  pdfUrl: "/files/catalog.pdf",
  pages: [
    {},                       // page 1
    { items: [                // page 2
      { type: "link", x: 80, y: 600, width: 300, height: 60, url: "https://example.com/shop" },
      { type: "link", x: 80, y: 700, width: 300, height: 60, page: 8 },
      { type: "youtube", x: 80, y: 120, width: 560, height: 315, url: "https://youtu.be/VIDEO_ID" }
    ]}
  ]
});
TypeWhat it showsKeys besides x, y, width, height
linkA clickable area: opens a URL, or turns to a page.url or page, target, tooltip
hotspotA pulsing marker with a tooltip or product card (next section).tooltip, url or page, hotspotStyle, dotColor, dotSize, pulse
spotlightAn area that opens an image, video or YouTube URL in a lightbox.url, title, description
imageAn image on the page.url
videoAn mp4 video on the page.url, autoplay, controls, loop, muted
audioAn mp3 player.url, autoplay, controls, loop
youtubeA YouTube video.url, autoplay, controls, loop, muted
iframeAny embed: a URL or full iframe code (Vimeo, maps, forms).url
textText on the page.textContent, fontFamily, fontSize, fontColor, bold, italic, underline

Video and audio pause when the page turns away and, with autoplay, play again when it comes back.

Hotspots and product cards

A hotspot shows a marker. Its tooltip is either text or a card with a picture, price and buttons:

{
  type: "hotspot", x: 300, y: 420, width: 40, height: 40,
  hotspotStyle: "dot",
  tooltip: {
    title: "Arne Sofa, three-seat",
    price: "€1,290",
    description: "Solid oak frame, wool upholstery.",
    image: "/img/arne-sofa.jpg",
    url: "https://example.com/products/arne-sofa",
    cartUrl: "https://example.com/cart/add?id=123"
  }
}
Hotspot product card open over a flipbook page
A hotspot with a product card.
  • url adds a View product button; cartUrl adds Add to cart (the chosen quantity is added to the URL). showQuantity: true adds a quantity stepper. images (an array) makes the picture a gallery.
  • hotspotStyle: dot (default), ring, plus, icon, tag, price (shows the price as a tag) or button.
  • points gives the hotspot any shape; pulse: false stops the animation.
  • Global options: hotspotDotColor, hotspotDotSize, hotspotTooltipWidth, and hotspotButtons: { radius, background, color, uppercase } for the card buttons.

Page HTML

For full control, give a page htmlContent: HTML drawn on a layer over the page (1000 px tall). These classes give elements flipbook behaviour:

{
  htmlContent:
    '<a class="flipbook-page-item" href="https://example.com" target="_blank" ' +
    'style="position:absolute;top:100px;left:100px;width:300px;height:60px"></a>' +
    '<a class="flipbook-page-item internalLink" data-page="5" href="#" ' +
    'style="position:absolute;top:200px;left:100px;width:300px;height:60px"></a>' +
    '<a class="flipbook-page-item spotlight" data-url="/video/intro.mp4" href="#" ' +
    'style="position:absolute;top:300px;left:100px;width:300px;height:200px"></a>'
}

Options

The most used options. Pass any of them to new FlipBook(element, options), or change style options later with setOptions.

Content

OptionDefaultWhat it does
pdfUrlnullPDF to show.
pages[]Page images, or per-page items for a PDF.
name""Name of the book, used in analytics, events and sharing.
tableOfContent[]Custom contents (see Table of contents).
startPage0Page to open on.
pageRangeStart, pageRangeEndnullShow only part of the PDF.
pageNumberOffset0Shift the page numbers shown.
pdfTextLayertrueText selection and search in PDFs.
pdfAutoLinksfalseTurn web addresses in PDF text into links.
disableRangefalseDownload the whole PDF instead of the parts being read.
cMapUrlFolder of the PDF character maps (assets/cmaps/), for PDFs with Asian fonts.
assets.flipMp3"assets/mp3/turnPage.mp3"Page-turn sound.

Display

OptionDefaultWhat it does
viewMode"webgl"webgl, 3d, 2d, swipe, scroll, simple.
layout1Toolbar layout 1 to 10.
skin"" (light)light, dark, gradient.
glassfalseFrosted toolbar and panels.
iconSet"fontawesome"fontawesome (solid) or lucide (outline).
accentColornullAccent for highlights and the progress bar.
backgroundColor"rgb(81, 85, 88)"Background behind the book.
backgroundImage, backgroundPattern""Background image (cover) or repeating pattern.
backgroundTransparentfalseNo background.
singlePageModefalseOne page at a time.
cover, backCovertrueSingle front and back cover.
hardCoverfalseStiff covers; hardCoverColor sets their edge color.
rightToLeftfalseRight-to-left reading.
pageFlipDuration1Turn speed in seconds.
soundtruePage-turn sound.
backgroundMusicfalseURL of an mp3 that plays while reading.
turnHinttrueOne-time hint that pages can be turned.
sideNavigationButtonstrueArrows at the sides of the book.
responsiveContainertrueSize the container to the book.
minimalViewfalseIn very small embeds (below minimalViewBreakpoint), show only an expand button.
logoImg, logoUrl, logoCSS""Logo over the book.
preloaderText""Text under the loading spinner.

Toolbar

OptionDefaultWhat it does
btnOrderall buttonsOrder of the buttons.
btn…Each button's settings (see Toolbar buttons).
progressBar{ enabled: false }Progress bar along the toolbar.
menuAutoHidefalseHide the toolbar on touch devices after menuAutoHideDelay ms.
hideMenufalseNo toolbar.
compactBreakpoint768Below this width, extra buttons move into More.
skinColor, skinBackground"#222", "#FFF"Toolbar icon and background colors.
btnSize, btnRadius, btnColor, btnBackground18, 2, "", "none"Toolbar buttons.
floatingBtnColor, floatingBtnBackground"#FFF", "rgba(0,0,0,0.6)"Buttons drawn over the book.
arrowColor, arrowBackground, arrowSize"#FFF", transparent, 40Side arrows.
sideMenuPosition"left"Side of the thumbnails and contents panels.
thumbnailsOnStart, contentOnStartfalseOpen the thumbnails or contents panel at start.
searchOnStartfalseA word to search for at start.
shareUrl, shareTitle, shareImagenullWhat the Share menu shares.

Zoom and navigation

OptionDefaultWhat it does
zoomMin0.95Book size when not zoomed.
zoomStep1.5Zoom per click.
zoomResetfalseZoom out after a page turn.
doubleClickZoomDisabledfalseTurn off double-click zoom.
wheelDisabledNotFullscreenfalseMouse wheel zooms only in fullscreen.
pageDragDisabledfalseTurn pages only with buttons and clicks.
arrowsAlwaysEnabledForNavigationtrueKeyboard arrows turn pages.
arrowsDisabledNotFullscreenfalseKeyboard arrows only in fullscreen.
deeplinkingEnabled, deeplinkingPrefixfalse, ""Page number in the URL.
autoplayOnStart, autoplayInterval, autoplayLoopfalse, 3000, trueTurn pages automatically.
rightClickEnabledtrueBrowser right-click menu.

Lightbox

OptionDefaultWhat it does
lightBoxfalseOpen from the element in a lightbox.
lightBoxOpenedfalseOpen when the page loads.
lightBoxFullscreenfalseOpen in fullscreen.
lightboxStartPagenullPage to open on.
lightboxBackgroundnullOverlay background (any CSS background).
lightboxMarginV, lightboxMarginH"0"Space around the lightbox.
lightboxPreloadfalseLoad before the first click.
lightboxCloseOnBacktrueBack button closes it.

Real 3D view

OptionDefaultWhat it does
lights, lightIntensitytrue, 0.6Lighting on the pages.
shadows, shadowOpacitytrue, 0.3Shadows of turning pages.
pageHardness, coverHardness2How stiff pages and covers are.
pan, tilt0Camera angle.
rotateCameraOnMouseDragtrueDrag outside the pages to rotate the camera.
pagesInMemory40Pages kept loaded; lower it for very long books.

Other

OptionDefaultWhat it does
googleAnalyticsTrackingCodenullGA4 measurement ID (G-…).
linkTarget"_blank"Where page links open.
stringsEnglishInterface text (see Translating).
mobileOptions that apply on phones and tablets.
customCSS""CSS added for this book.

API and events

new FlipBook() returns the flipbook. FLIPBOOK.getBook(elementOrId) returns the flipbook created in an element, for example from another script.

const book = new FlipBook(document.getElementById("container"), { pdfUrl: "/files/brochure.pdf" });

book.nextPage();
book.prevPage();
book.goToPage(12);
book.firstPage();
book.lastPage();
book.zoomIn();
book.zoomOut();
book.toggleExpand();        // fullscreen on or off
book.toggleAutoplay(true);
book.toggleThumbs(true);
book.toggleToc(true);

// change the look without reloading
book.setOptions({ layout: 4, skin: "dark", iconSet: "lucide" });

setOptions changes the toolbar layout, skin, colors, background and icons of a flipbook that is already on the page.

Events

// on the flipbook
book.on("pagechange", function () { console.log("page changed"); });

// on window, for every flipbook on the page
window.addEventListener("r3d-pagechange", e => console.log(e.detail.page, e.detail.name));
window.addEventListener("r3d-lightboxopen", () => console.log("opened"));
window.addEventListener("r3d-lightboxclose", () => console.log("closed"));

// every reader action
window.addEventListener("r3d-event", e => console.log(e.detail));

r3d-event reports reader actions with or without Google Analytics: event (the action), the page number, the URL or label where there is one, and the book's name and id. Use it to send reading data to your own analytics.

Analytics

Set googleAnalyticsTrackingCode: "G-XXXXXXX". The flipbook loads Google Analytics if the page doesn't already have it and sends events such as flipbook_page_view, flipbook_page_link_click, flipbook_hotspot_click, flipbook_pdf_download, flipbook_share, flipbook_zoom, flipbook_print, flipbook_page_video_play and the flipbook_audio_* events. Each carries the book name, so you can compare books.

Translating

Button tooltips are the title of each button. Panel and menu text is in strings:

new FlipBook(el, {
  pdfUrl: "/files/katalog.pdf",
  btnThumbs: { title: "Seiten" },
  btnSearch: { title: "Suchen" },
  strings: {
    search: "Suchen",
    findInDocument: "Im Dokument suchen",
    noMatches: "Keine Treffer",
    tableOfContent: "Inhalt",
    print: "Drucken",
    download: "Herunterladen",
    copyLink: "Link kopieren",
    addToCart: "In den Warenkorb"
  }
});

Other keys include printLeftPage, printRightPage, printCurrentPage, printAllPages, the matching download… and bookmark… keys, bookmarks, noBookmarks, thumbnails, share, page, matchesFound and viewProduct.

Faster loading

  • Keep HTTP range requests working on your server (most do), so the PDF downloads in parts as pages are read. Don't set disableRange.
  • Save the PDF web-optimized (linearized), with about 150 dpi photos and JPEG compression.
  • For long or heavy PDFs, convert the PDF to images and use pages with json for text and links. Pages then load as images and the PDF reader is not loaded at all.
  • Image pages: JPG or WebP of about 200 to 300 KB, no more than 2000 to 3000 px tall, with a thumb for each page.
  • Use the lightbox when the flipbook isn't the main content, so nothing loads until a reader opens it.
  • Give phones a smaller PDF with mobile: { pdfUrl: "…" }, and lower pagesInMemory for very long books.

Troubleshooting

The examples don't work when I open them from disk

Browsers block PDFs and scripts loaded from file://. Put the files on a web server or a local server (for example npx serve or python3 -m http.server) and open them from http://localhost.

The flipbook doesn't show

Open the browser console (F12) and look for errors. The usual causes: the path to the PDF or images is wrong, the files are on another domain (next item), the container has no height, or the js folder is incomplete.

The PDF or images load from another domain (CORS)

The server with the files must allow your site to read them. On Apache (.htaccess):

<IfModule mod_headers.c>
  Header set Access-Control-Allow-Origin "*"
  Header set Access-Control-Allow-Headers "Range"
  Header set Access-Control-Expose-Headers "Accept-Ranges, Content-Encoding, Content-Length, Content-Range"
</IfModule>

On Nginx, add the same three headers with add_header. On Amazon S3, add a CORS rule that allows GET and HEAD, the Range header and exposes Accept-Ranges, Content-Length and Content-Range. Replace * with your site address to allow only your site.

The page-turn sound doesn't play

Check that assets.flipMp3 points at the mp3 in your assets/mp3/ folder.

The flipbook asks for a license on my site

Activate the domain the page runs on (see Activate your license). A license moved to a new domain must be deactivated on the old one first.

Support

Contact us

Ask on real3dflipbook.com. Include the page URL and what you see in the browser console.

Examples

See view modes and layouts on the examples page.

Changelog

changelog.txt in the zip lists what changed in each version.