This will display a pdf in the format we discussed, currently it loads in a hardcoded filename "test_pdf.pdf" then displays it.
The viewbox consists of a VBox, with a Canvas inside. The VBox background is set to an image of the pdf, the canvas will allow us to draw on top of the pdf to export later. To draw on the canvas, you need to access the GraphicsContext from the page you want to edit. The pages array inside of app, contains individual pages, each with their own graphics context. This allows us to swap out whichever pdf page we want to display easily as each page is initialized with it's own node and graphics context we can switch between, or display elsewhere in the UI.
This will display a pdf in the format we discussed, currently it loads in a hardcoded filename "test_pdf.pdf" then displays it.
The viewbox consists of a
VBox
, with aCanvas
inside. TheVBox
background is set to an image of the pdf, the canvas will allow us to draw on top of the pdf to export later. To draw on the canvas, you need to access theGraphicsContext
from the page you want to edit. The pages array inside of app, contains individual pages, each with their own graphics context. This allows us to swap out whichever pdf page we want to display easily as each page is initialized with it's own node and graphics context we can switch between, or display elsewhere in the UI.