DryCreations / pdfproject

Adapting starter code that uses itext7, into a program that can draw onto pdfs, and export files to pdf
1 stars 3 forks source link

Action 37: add ability to export pdf document #33

Closed DryCreations closed 3 years ago

DryCreations commented 3 years ago

image

clicking save will prompt the user to select a location to save the file to, then a new pdf document with the changes is created.

image

DryCreations commented 3 years ago

There are foreseeable compatibility issues with this pull request: https://github.com/DryCreations/pdfproject/pull/36

I will close this until I resolve them.

DryCreations commented 3 years ago

Changes have been made to be compatible with https://github.com/DryCreations/pdfproject/pull/36

Currently the save function does work with all tools, except the eraser.

I see some issues arising form design decisions that we have made already, that will make implementing this erase tool very difficult.

  1. PdfCanvas does not have a way to draw transparant areas like javafx does, everything is stacked on top of eachother when drawn, so transparent objects see through beneath them.
  2. What happens when entire objects are "erased" on the canvas, they still exist and they're still selectable. Partially erased objects are very difficult to draw if not impossible on the pdfcanvas.

Currently I have just made the eraser draw in white, however this is not consistent with our javafx canvas; The eraser does not affect the background pdf when drawing on the javafx canvas. However with the pdfcanvas, the text that's in the background can be overwritten.

It might make sense to change the eraser tools functionality. I see a few possible changes:

  1. just make the eraser a pen that matches the background color.
  2. make the eraser delete entire objects it passes over.
  3. get rid of the eraser, and use a select then delete command everytime the user needs to delete something.

if anyone else is able to figure out a good way to erase things on the pdfcanvas, feel free to say so. I'm currently messing with masks, and shading to see if I can get it to work.