npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-pdf-quizmanager

v1.0.17

Published

react-pdf-quizmanager

Readme

developing~

Node Version 20.11.1 개발중..
do not use please example


import React, { useMemo, useRef, useState } from 'react';
import { useCallback } from 'react';

import "./App.scss"

import { PDFEnrollQuiz, PDFPlayQuiz } from 'react-pdf-quizmanager';
import type { Coordinate, PDFPlayQuizProps } from 'react-pdf-quizmanager';



function App() {


  const [tempAOI, setTempAOI] = useState<Coordinate[][]>([
    [{
      x: 6,
      y: 32,
      width: 33,
      height: 10,
      id: '1234',
      type: "MC", // 객관식 Multiple Choice
      name: "객관식(1-1)",
      quizOptionCount: 3, //(1~10 선택가능)
      correctAnswer: 1, //1번이 정답    0번은 정답없음

    }, {
      x: 6,
      y: 43,
      width: 42,
      height: 14,
      id: '5678',
      type: "SJ", //주관식 Subject
      name: "주관식(1-2)",
      correctAnswer: "",
    }], //1번페이지  없는페이지는 자동생성
  ])




  const [file, set_file] = useState<File | null>(null);

  const [pdfURL, set_pdfURL] = useState<string>("");


  const handleDocumentLoadCallback = useCallback((pages: number) => {
    console.log("콜백옴 page수", pages);
    // set_maxPageNumber(pages);
  }, []);




  const option = useMemo(() => {
    //pdf 고유의 사이즈를 무시, 현제의 width기준으로 랜더
    return {
      pageViewOption: {
        initViewPercent: '50%',
      },
      previewOption: {
        initLeftPreviewshow: true,
        pageMargin: 40, //preview 의 작은 PDF의 pagemargin
        wrapperStyle: { //PDF preview의 껍데기 width입니다
          width: 200,
          // outline:"5px solid red"
        }
      }

    };
  }, [])



  const [pdfName, set_pdfName] = useState<string>("이것은PDF파일이름");

  const fileRef = useRef<HTMLInputElement>(null);

  const handleAddFile = (e) => {
    // console.log(e.target.files[0]);
    //if (!e.target.files[0]) return;
    if (e.target.files[0].type !== 'application/pdf') {
      // Swal.fire("지원하지 않는 확장자 입니다");
      return;
    }



    const tmpfile = e.target.files[0];
    set_file(tmpfile);
  }

  const handleOpenPreview = () => {
    if (!file) return;
    const logoURL = window.URL.createObjectURL(file);
    set_pdfURL(prev => {
      if (prev) {
        console.log("메모리해제");
        window.URL.revokeObjectURL(prev);
        console.log("메모리끝");
      }
      return logoURL
    });
  }

  const [playOption, set_playOption] = useState<PDFPlayQuizProps | null>(null);

  // console.log("tempAOI",tempAOI)
  return (<div className="app" style={{ background: "#eee" }} >
    <div>
      {pdfURL}
      <br />
      {file && <> {`임시파일이름 : ${file.name}`} <button className="deletefilebtn" onClick={() => set_file(null)}>삭제</button></>}
      <input ref={fileRef} style={{ display: 'none' }}
        accept="application/pdf"
        type="file" onChange={handleAddFile} />
      <br />
      <button
        className="btn"
        onClick={() => {
          if (fileRef.current) {
            fileRef.current.value = "";
            fileRef.current.click();
          }
        }}>내컴퓨터에서 찾기</button>

      <button onClick={handleOpenPreview}>
        (제작)파일열기
      </button>
      <button onClick={() => { set_pdfURL("https://readerseye-quiz.s3.ap-northeast-2.amazonaws.com/published/3_1716436060677.pdf") }}>
        (제작)임시url열기
      </button>
    </div>
    <br />
    <div>
      (테스트)파일열기
      <br />
      <button onClick={() => set_playOption({
        path: "https://readerseye-quiz.s3.ap-northeast-2.amazonaws.com/published/3_1716436060677.pdf",
        AOI: tempAOI
      })}>play urlAOI적용</button>
    </div>






    {pdfURL &&
      <div style={{ marginLeft: "5%", width: '90%', height: '700px', display: "flex", background: "#fff" }}>
        {/* // <div style={{  width: '100%', height: '100%',left:0,top:0,position:"fixed", display: "flex", background: "#fff" }}> */}
        <PDFEnrollQuiz
          path={pdfURL}
          AOI={tempAOI}
          option={option}
          pdfInform={{
            fileName: pdfName
          }}

          PDFDocumentOnLoadCallback={handleDocumentLoadCallback}


          onCloseCallback={() => {
            set_pdfURL(prev => {
              if (prev) {
                console.log("메모리해제");
                window.URL.revokeObjectURL(prev);
                console.log("메모리해제끝");
              }
              return ""
            });
          }}

          onSaveCallback={(newAOI: Coordinate[][], newFileName: string) => {
            setTempAOI(newAOI);
            set_pdfName(newFileName);
          }}

        />

      </div>
    }


    {playOption &&
      <div style={{ width: '100%', height: '100%', left: 0, top: 0, position: "fixed", display: "flex", background: "#fff" }}>
        <PDFPlayQuiz

          path={playOption.path}
          AOI={playOption.AOI}

          PDFDocumentOnLoadCallback={() => {

          }}
          onCloseCallback={(saveAOI:Coordinate[][],duration:number) => {
            console.log("저장할응답결과", saveAOI)
            console.log("측정시간",duration)

            set_playOption((prev: PDFPlayQuizProps | null) => {
              if (prev) {
                console.log("메모리해제");
                window.URL.revokeObjectURL(prev.path);
                console.log("메모리해제끝");
              }
              return null
            });
          }}



        />

      </div>

    }

  </div>)
}

export default App;