-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: pdf を表示するコンポーネントを作成しました * chore: pdf を見やすくしました * feat: 差分を表示するようにしました --------- Co-authored-by: Keisuke Ishigami <[email protected]>
- Loading branch information
1 parent
1feb685
commit 005e7b3
Showing
175 changed files
with
1,411 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
�RCopyright 1990-2009 Adobe Systems Incorporated. | ||
All rights reserved. | ||
See ./LICENSE�CNS2-H |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
�RCopyright 1990-2009 Adobe Systems Incorporated. | ||
All rights reserved. | ||
See ./LICENSE� ETen-B5-H` ^ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
%%Copyright: ----------------------------------------------------------- | ||
%%Copyright: Copyright 1990-2009 Adobe Systems Incorporated. | ||
%%Copyright: All rights reserved. | ||
%%Copyright: | ||
%%Copyright: Redistribution and use in source and binary forms, with or | ||
%%Copyright: without modification, are permitted provided that the | ||
%%Copyright: following conditions are met: | ||
%%Copyright: | ||
%%Copyright: Redistributions of source code must retain the above | ||
%%Copyright: copyright notice, this list of conditions and the following | ||
%%Copyright: disclaimer. | ||
%%Copyright: | ||
%%Copyright: Redistributions in binary form must reproduce the above | ||
%%Copyright: copyright notice, this list of conditions and the following | ||
%%Copyright: disclaimer in the documentation and/or other materials | ||
%%Copyright: provided with the distribution. | ||
%%Copyright: | ||
%%Copyright: Neither the name of Adobe Systems Incorporated nor the names | ||
%%Copyright: of its contributors may be used to endorse or promote | ||
%%Copyright: products derived from this software without specific prior | ||
%%Copyright: written permission. | ||
%%Copyright: | ||
%%Copyright: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
%%Copyright: CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
%%Copyright: INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
%%Copyright: MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
%%Copyright: DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
%%Copyright: CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
%%Copyright: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
%%Copyright: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
%%Copyright: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
%%Copyright: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
%%Copyright: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
%%Copyright: OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
%%Copyright: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
%%Copyright: ----------------------------------------------------------- |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use client'; | ||
|
||
import { useState } from 'react'; | ||
import { pdfjs, Document, Page } from 'react-pdf'; | ||
import { Button } from '@mui/material'; | ||
import 'react-pdf/dist/Page/AnnotationLayer.css'; | ||
import 'react-pdf/dist/Page/TextLayer.css'; | ||
|
||
// PDF.jsのワーカーの設定 | ||
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.min.js`; | ||
|
||
interface PDFViewerProps { | ||
file: string; | ||
} | ||
|
||
const options = { | ||
cMapUrl: '/cmaps/', | ||
cMapPacked: true, | ||
}; | ||
|
||
const PDFViewer: React.FC<PDFViewerProps> = ({ file }) => { | ||
const [numPages, setNumPages] = useState<number | null>(null); | ||
const [pageNumber, setPageNumber] = useState(1); // 現在のページ番号 | ||
|
||
const onDocumentLoadSuccess = ({ numPages }: { numPages: number }) => { | ||
setNumPages(numPages); | ||
}; | ||
|
||
const nextPage = () => { | ||
if (numPages === null) return; // numPagesがnullなら何もしない | ||
setPageNumber((prevPageNumber) => | ||
prevPageNumber < numPages ? prevPageNumber + 1 : prevPageNumber, | ||
); | ||
}; | ||
|
||
const previousPage = () => { | ||
if (numPages === null) return; // numPagesがnullなら何もしない | ||
setPageNumber((prevPageNumber) => | ||
prevPageNumber > 1 ? prevPageNumber - 1 : prevPageNumber, | ||
); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Button | ||
onClick={previousPage} | ||
disabled={pageNumber <= 1} | ||
variant='outlined' | ||
sx={{ mr: 4 }} | ||
> | ||
前のページ | ||
</Button> | ||
ページ {pageNumber} / {numPages} | ||
<Button | ||
onClick={nextPage} | ||
disabled={pageNumber >= (numPages ?? 0)} | ||
variant='outlined' | ||
sx={{ ml: 4 }} | ||
> | ||
次のページ | ||
</Button> | ||
<Document | ||
file={file} | ||
onLoadSuccess={onDocumentLoadSuccess} | ||
options={options} | ||
> | ||
<Page pageNumber={pageNumber} /> | ||
</Document> | ||
</> | ||
); | ||
}; | ||
|
||
export default PDFViewer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters