Skip to content

Commit

Permalink
formatting?
Browse files Browse the repository at this point in the history
  • Loading branch information
lfoppiano committed Nov 30, 2023
1 parent 89bc8a9 commit 8dd4e4e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions streamlit_pdf_viewer/frontend/src/PdfViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
</template>

<script>
import { onMounted, onUpdated } from "vue"
import {onMounted, onUpdated} from "vue"
import "pdfjs-dist/build/pdf.worker.entry"
import { getDocument } from "pdfjs-dist/build/pdf"
import { Streamlit } from "streamlit-component-lib"
import {getDocument} from "pdfjs-dist/build/pdf"
import {Streamlit} from "streamlit-component-lib"
export default {
Expand All @@ -27,10 +27,10 @@ export default {
pdfViewer?.removeChild(canvases.item(j))
}
loadingTask.promise.then(async function(pdf) {
loadingTask.promise.then(async function (pdf) {
for (let i = 1; i <= pdf.numPages; i++) {
const page = await pdf.getPage(i)
const viewport = page.getViewport({ scale: 1 })
const viewport = page.getViewport({scale: 1})
const canvas = document.createElement("canvas")
const context = canvas.getContext("2d")
pdfViewer?.append(canvas)
Expand All @@ -39,18 +39,18 @@ export default {
if (canvas.width > maxWidth) {
maxWidth = canvas.width
}
totalHeight += canvas.height
totalHeight += canvas.height
console.log(canvas.height)
console.log(canvas.width)
// console.log(canvas.height)
// console.log(canvas.width)
canvas.style.display = "block"
const renderContext = {
canvasContext: context,
viewport: viewport,
}
const renderTask = page.render(renderContext)
renderTask.promise.then(function() {
renderTask.promise.then(function () {
console.log("Page rendered")
})
console.log(i)
Expand Down

0 comments on commit 8dd4e4e

Please sign in to comment.