What best file extension to save document in a program?

I have a simple little program to tracking letter and document it uses scan to get the document image. I made it with vuejs + electron + sqlite

Okay this is my question i save my document file in scan with jpeg format. but many of the document not are just one page long, maybe 4 maybe 5. One time i notice that saving my scan on jpeg format is make the path to the image are so complex if i’m not divide it by folder per document.

I want to make it pdf then since there is no proper plugin to scan a multiple page in electron (if you have or know it tell me) the pdf format document are still make same problem as jpg format.what should i choose? What your opinion?