├── components ├── debug-tree.module.css ├── elements-tree.module.css ├── viewer.module.css ├── box-sizing.module.css ├── box-sizing.js ├── repl-layout.module.css ├── repl-layout.js ├── elements-tree.js ├── viewer.js └── debug-tree.js ├── .eslintrc ├── public ├── og.png ├── favicon.ico └── favicon.svg ├── pages └── api │ ├── g-template.png │ └── og.js ├── app ├── sandpack │ ├── example │ │ ├── vite.config.js │ │ ├── styles.css │ │ ├── index.html │ │ ├── package.json │ │ ├── index.jsx │ │ └── Document.jsx │ ├── layout.js │ ├── global-styles.js │ └── page.js ├── sitemap.js ├── robots.js ├── layout.js ├── error.js ├── globals.css ├── page.js └── repl.js ├── worker ├── process-jsx.js ├── index.js ├── executer.js ├── to-module.js └── better-static-module-record.mjs ├── .gitignore ├── .github └── workflows │ └── update-react-pdf.yml ├── LICENSE ├── code ├── lz.js └── default-example.js ├── state ├── page.js └── debugger.js ├── package.json ├── next.config.js ├── hooks └── index.js ├── patches └── pdfjs-dist+3.3.122.patch └── README.md /components/debug-tree.module.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["next", "next/core-web-vitals"] 3 | } 4 | -------------------------------------------------------------------------------- /public/og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeetiss/react-pdf-repl/HEAD/public/og.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeetiss/react-pdf-repl/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /pages/api/g-template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeetiss/react-pdf-repl/HEAD/pages/api/g-template.png -------------------------------------------------------------------------------- /app/sandpack/example/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite"; 2 | import react from "@vitejs/plugin-react"; 3 | 4 | export default defineConfig({ 5 | plugins: [react()], 6 | }); 7 | -------------------------------------------------------------------------------- /app/sitemap.js: -------------------------------------------------------------------------------- 1 | export default async function sitemap() { 2 | return [""].map((route) => ({ 3 | url: `https://react-pdf-repl.vercel.app${route}`, 4 | lastModified: new Date().toISOString().split("T")[0], 5 | })); 6 | } 7 | -------------------------------------------------------------------------------- /app/sandpack/example/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | } 4 | 5 | html, 6 | body, 7 | div#root, 8 | .Viewer { 9 | width: 100%; 10 | height: 100%; 11 | } 12 | 13 | .Viewer { 14 | display: block; 15 | border: none; 16 | } 17 | -------------------------------------------------------------------------------- /app/robots.js: -------------------------------------------------------------------------------- 1 | export default function robots() { 2 | return { 3 | rules: [ 4 | { 5 | userAgent: "*", 6 | }, 7 | ], 8 | sitemap: "https://react-pdf-repl.vercel.app/sitemap.xml", 9 | host: "https://react-pdf-repl.vercel.app", 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /app/layout.js: -------------------------------------------------------------------------------- 1 | import { Analytics } from "@vercel/analytics/react"; 2 | 3 | import "./globals.css"; 4 | 5 | export default function RootLayout(props) { 6 | return ( 7 | 8 | 9 | {props.children} 10 | 11 | 12 | 13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /app/sandpack/example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vite App 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/sandpack/layout.js: -------------------------------------------------------------------------------- 1 | import { GlobalSandpackStyles } from "./global-styles"; 2 | 3 | /** @type {import('next').Metadata} */ 4 | export const metadata = { 5 | title: "Sandpack", 6 | description: "react-pdf/renderer with sandpack", 7 | robots: "noindex, nofollow", 8 | }; 9 | 10 | export default function RootLayout(props) { 11 | return {props.children}; 12 | } 13 | -------------------------------------------------------------------------------- /app/sandpack/example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "dev": "vite", 4 | "build": "vite build", 5 | "preview": "vite preview" 6 | }, 7 | "dependencies": { 8 | "@react-pdf/renderer": "^3.1.9", 9 | "react": "^18.2.0", 10 | "react-dom": "^18.2.0" 11 | }, 12 | "devDependencies": { 13 | "@vitejs/plugin-react": "^4.0.0", 14 | "vite": "4.2.0", 15 | "esbuild-wasm": "^0.17.18" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/error.js: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { log } from "next-axiom/dist/logger"; 4 | import { useEffect } from "react"; 5 | 6 | export default function Error({ error, reset }) { 7 | useEffect(() => { 8 | log.error(error.message, { error }); 9 | }, [error]); 10 | 11 | return ( 12 |
13 |

Something went wrong!

14 | 15 |
16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /app/globals.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | padding: 0; 4 | margin: 0; 5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, 6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; 7 | 8 | height: 100%; 9 | } 10 | 11 | body > div#__next { 12 | height: 100%; 13 | } 14 | 15 | a { 16 | color: inherit; 17 | text-decoration: none; 18 | } 19 | 20 | * { 21 | box-sizing: border-box; 22 | } 23 | -------------------------------------------------------------------------------- /app/sandpack/example/index.jsx: -------------------------------------------------------------------------------- 1 | import { StrictMode } from "react"; 2 | import { createRoot } from "react-dom/client"; 3 | import { PDFViewer } from "@react-pdf/renderer"; 4 | 5 | import MyDocument from "./Document"; 6 | import "./styles.css"; 7 | 8 | const root = createRoot(document.getElementById("root")); 9 | root.render( 10 | 11 | 12 | 13 | 14 | 15 | ); 16 | -------------------------------------------------------------------------------- /app/sandpack/global-styles.js: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { getSandpackCssText } from "@codesandbox/sandpack-react"; 4 | import { useServerInsertedHTML } from "next/navigation"; 5 | 6 | export const GlobalSandpackStyles = ({ children }) => { 7 | useServerInsertedHTML(() => { 8 | return ( 9 |