Convert Figma logo to code with AI

embedpdf logoembed-pdf-viewer

A PDF viewer that seamlessly integrates with any JavaScript project

1,100
48
1,100
21

Top Related Projects

51,994

PDF Reader in JavaScript

2,293

vue.js pdf viewer

26,978

Convert PDF to markdown + JSON quickly with high accuracy

10,537

Display PDFs in your React app as easily as if they were images.

12,113

Client/server side PDF printing in pure JavaScript

Quick Overview

Embed PDF Viewer is a lightweight JavaScript library that allows developers to easily embed PDF documents into web pages. It provides a customizable viewer with various controls and options for displaying PDFs directly within a website, without requiring users to download or open the document in a separate application.

Pros

  • Easy integration with minimal setup required
  • Customizable appearance and controls
  • Responsive design that works well on both desktop and mobile devices
  • No server-side dependencies, making it suitable for static websites

Cons

  • Limited advanced PDF manipulation features
  • May not support all PDF features or complex layouts
  • Requires modern browsers with PDF.js support
  • Performance may be affected for large PDF files

Code Examples

  1. Basic PDF embedding:
const viewer = new EmbedPdfViewer({
  element: '#pdf-container',
  url: 'path/to/document.pdf'
});
  1. Customizing viewer controls:
const viewer = new EmbedPdfViewer({
  element: '#pdf-container',
  url: 'path/to/document.pdf',
  controls: {
    download: false,
    print: false,
    fullscreen: true
  }
});
  1. Setting initial page and zoom level:
const viewer = new EmbedPdfViewer({
  element: '#pdf-container',
  url: 'path/to/document.pdf',
  initialPage: 5,
  zoom: 1.5
});

Getting Started

To use Embed PDF Viewer in your project, follow these steps:

  1. Include the library in your HTML file:
<script src="https://cdn.jsdelivr.net/npm/embed-pdf-viewer@latest/dist/embed-pdf-viewer.min.js"></script>
  1. Create a container element in your HTML:
<div id="pdf-container"></div>
  1. Initialize the viewer in your JavaScript code:
document.addEventListener('DOMContentLoaded', () => {
  const viewer = new EmbedPdfViewer({
    element: '#pdf-container',
    url: 'path/to/your/document.pdf'
  });
});

That's it! The PDF viewer will now be embedded in your web page.

Competitor Comparisons

51,994

PDF Reader in JavaScript

Pros of pdf.js

  • More comprehensive and feature-rich PDF rendering solution
  • Widely adopted and maintained by Mozilla, ensuring long-term support
  • Extensive documentation and community support

Cons of pdf.js

  • Larger file size and potentially more complex integration
  • May be overkill for simple PDF embedding needs
  • Steeper learning curve for customization

Code Comparison

embed-pdf-viewer:

<embed-pdf src="path/to/your/pdf.pdf"></embed-pdf>

pdf.js:

<div id="pdf-viewer"></div>
<script src="pdf.js"></script>
<script>
  pdfjsLib.getDocument('path/to/your/pdf.pdf').promise.then(function(pdf) {
    // Render PDF pages
  });
</script>

Summary

embed-pdf-viewer is a lightweight, easy-to-use solution for embedding PDFs in web pages. It offers a simple API and is ideal for basic PDF viewing needs. On the other hand, pdf.js is a more robust and feature-rich PDF rendering library maintained by Mozilla. It provides advanced functionality and wider browser support but may be more complex to implement and customize.

The choice between the two depends on the specific requirements of your project. If you need a quick and simple PDF embedding solution, embed-pdf-viewer might be the better choice. For more advanced PDF rendering and manipulation capabilities, pdf.js would be the preferred option.

2,293

vue.js pdf viewer

Pros of vue-pdf

  • Vue.js specific implementation, offering seamless integration with Vue applications
  • More comprehensive PDF handling features, including page navigation and zooming
  • Active development with regular updates and bug fixes

Cons of vue-pdf

  • Larger bundle size due to more features and dependencies
  • Steeper learning curve for developers not familiar with Vue.js
  • May be overkill for simple PDF embedding needs

Code Comparison

embed-pdf-viewer:

<embed-pdf src="path/to/your/file.pdf"></embed-pdf>

vue-pdf:

<template>
  <pdf src="path/to/your/file.pdf" :page="1" @num-pages="pageCount = $event"></pdf>
</template>

<script>
import pdf from 'vue-pdf'

export default {
  components: { pdf },
  data() {
    return { pageCount: 0 }
  }
}
</script>

The embed-pdf-viewer offers a simpler implementation with a single custom element, while vue-pdf provides more control and features through Vue.js component structure. embed-pdf-viewer is more suitable for quick, straightforward PDF embedding, whereas vue-pdf is better for complex PDF interactions within Vue applications.

26,978

Convert PDF to markdown + JSON quickly with high accuracy

Pros of marker

  • More comprehensive PDF annotation features, including highlighting and commenting
  • Supports collaborative editing and real-time synchronization
  • Offers a wider range of customization options for the viewer interface

Cons of marker

  • Potentially more complex to implement due to additional features
  • May have a steeper learning curve for users unfamiliar with advanced annotation tools
  • Could be overkill for simple PDF embedding needs

Code Comparison

embed-pdf-viewer:

<embed-pdf src="path/to/document.pdf" width="800" height="600"></embed-pdf>

marker:

const viewer = new PDFViewer({
  container: '#pdf-container',
  url: 'path/to/document.pdf',
  annotationTools: ['highlight', 'comment', 'draw'],
  collaborativeEditing: true
});

The code comparison shows that embed-pdf-viewer offers a simpler, more straightforward implementation for basic PDF embedding. In contrast, marker provides more configuration options and features out of the box, allowing for a more feature-rich PDF viewing and annotation experience.

10,537

Display PDFs in your React app as easily as if they were images.

Pros of react-pdf

  • More comprehensive PDF rendering capabilities, including support for forms and annotations
  • Better performance for large PDF files due to lazy loading and virtualization
  • Extensive customization options and API for advanced use cases

Cons of react-pdf

  • Steeper learning curve due to more complex API and configuration options
  • Larger bundle size, which may impact initial load times for web applications
  • Requires more setup and configuration compared to simpler solutions

Code Comparison

embed-pdf-viewer:

<embed-pdf src="path/to/document.pdf"></embed-pdf>

react-pdf:

import { Document, Page } from 'react-pdf';

function MyApp() {
  return (
    <Document file="path/to/document.pdf">
      <Page pageNumber={1} />
    </Document>
  );
}

The embed-pdf-viewer provides a simpler, more straightforward implementation with a single custom element. In contrast, react-pdf offers more granular control over the rendering process, allowing developers to handle individual pages and customize the viewer's behavior.

While embed-pdf-viewer is easier to use for basic PDF embedding, react-pdf provides more flexibility and features for complex PDF-related tasks in React applications. The choice between the two depends on the specific requirements of the project and the desired level of customization.

12,113

Client/server side PDF printing in pure JavaScript

Pros of pdfmake

  • Allows dynamic PDF generation on the client-side
  • Offers extensive customization options for PDF content and styling
  • Supports complex layouts, tables, and images

Cons of pdfmake

  • Steeper learning curve due to its comprehensive feature set
  • Larger file size and potentially slower performance for simple PDF viewing tasks
  • Requires more setup and configuration compared to embed-pdf-viewer

Code Comparison

embed-pdf-viewer:

<embed-pdf src="path/to/document.pdf"></embed-pdf>

pdfmake:

var docDefinition = {
  content: [
    'First paragraph',
    'Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines'
  ]
};
pdfMake.createPdf(docDefinition).download();

embed-pdf-viewer is a simpler solution for embedding existing PDFs, while pdfmake offers powerful PDF generation capabilities but requires more complex setup and usage.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

EmbedPDF logo

EmbedPDF

License Live demo Join our Discord

Open‑Source JavaScript PDF Viewer

EmbedPDF is a framework‑agnostic, MIT‑licensed PDF viewer that drops into any JavaScript project. Whether you build with React, Vue, Svelte, Preact, or vanilla JS, EmbedPDF delivers a smooth, modern reading experience and a clean developer API.


📚 Documentation

Full docs, installation guides, API reference, and examples:

👉 https://www.embedpdf.com

🚀 Live Demo

Try it now — load your own PDF or use the sample:

👉 https://app.embedpdf.com


✨ Features

  • Annotations (highlight, sticky notes, free text, ink)
  • True redaction (content is actually removed)
  • Search, text selection, zoom, rotation
  • Smooth, virtualized scrolling
  • Pluggable architecture & tree-shakable plugins

🤝 Contributing

We love contributions! To get started, read our contributing guide and jump into the GitHub discussions.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

Third-Party Licenses

This project includes PDFium, licensed under the Apache License, Version 2.0.