Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import from PDF files #496

Closed
rklett opened this issue Oct 16, 2021 · 8 comments · Fixed by #1795
Closed

Import from PDF files #496

rklett opened this issue Oct 16, 2021 · 8 comments · Fixed by #1795
Assignees
Labels
common: uncommon Most users are unlikely to come across this or unexpected workflow severity: minor Impairs non-critical functionality or suitable workarounds exist type: enhancement New feature or request

Comments

@rklett
Copy link

rklett commented Oct 16, 2021

I'd like to be able to use Catima to store and display e-tickets which have been provided in PDF format with embedded QR codes. I suppose the workaround for this is to either take a screenshot of the PDF on my phone and import that or to scan the QR code off my computer screen. Both of these are a bit of a hassle that I'd like to avoid if Catima supported importing a PDF.

Maybe something to consider is that usually these PDFs come with one page per ticket with each page/ticket having a separate QR code. I expect this complicates things more than just adding a PDF reading library but we can set the aside for now.

@TheLastProject TheLastProject added type: enhancement New feature or request state: help wanted I looked into this issue but couldn't solve it quickly labels Oct 16, 2021
@TheLastProject
Copy link
Member

So it seems to me this is actually multiple features working together and it would be best to implement all of these, although only #3 is really necessary for this feature.

1: Let Catima handle share intents for images (so that sharing an image to Catima works).
2. Extend the image reading to look for multiple codes (so, start with the "Select image from gallery" button in adding a barcode) and offer the user to add one or more of the found codes (right now, I think the code stops as soon as it found a single code)
3. Support PDF files (is there a small library that can convert those to images perhaps to keep the code simple?). Maybe only support this in the share intent so we still just open the gallery on the "Scan Card Barcode" screen

@rklett
Copy link
Author

rklett commented Oct 20, 2021

I can't really help with the first two but the third one, I've seen similar features in https://github.com/michaeltroger/greenpass-android. Unfortunately, that app keeps crashing for me on my new phone after I imported a PDF but I had it sort of working on an older phone.

Poking around, I think it uses https://github.com/TomRoush/PdfBox-Android for the PDF handling. I'm not a developer though so my contributions probably end here. I'll keep an eye out in case anything comes up that I might be able to help with.

@TheLastProject TheLastProject removed the state: help wanted I looked into this issue but couldn't solve it quickly label Dec 18, 2021
@famo
Copy link

famo commented Jan 7, 2022

@rklett you might want to check out https://github.com/ligi/PassAndroid, which is actually made for tickets and also supports import of PDF tickets. HTH

@TheLastProject TheLastProject added common: uncommon Most users are unlikely to come across this or unexpected workflow severity: minor Impairs non-critical functionality or suitable workarounds exist labels Feb 5, 2022
@atharen
Copy link

atharen commented Aug 12, 2022

Quoting from #977, noting only PDF import related mentions:

Treating PDF files as images and letting them go through the cropper, making sure that multi-page PDF files will stay multi-page (probably by just putting all pages below or next to each other). (Side note: Supporting PDFs as image input also has the benefit of being able to support them in "Scan Barcode -> Select image from gallery" for new barcodes to be added, such as for #907)

Either 1 picture per PDF (collate all pages into 1 image), or an image for each page - the first suggestion works best if you have multiple PDFs, but the latter works best when you only have 1 PDF, so you can swipe over each individual image/page. It's an implementation detail so I'll leave it to be discussed in the appropriate task.

One or two pages are easy enough, but if you get 5 or more pages it'll look awful.

Potential Libraries for the implementation:

I was trying to convert my PDF on device (though ended up using my PC, as it was easier), and found 2 open-source apps which advertise this functionality:
- Swati4star/Images-to-PDF which is on-going, but for me it bugs out, and Swati4star/Images-to-PDF#1083.
- scoute-dich/PDFCreator which archived for like 5 years, but worked quite well, but the UI, is poor tbh (doesn't matter, the library is what counts) - if 1, had vulnerabilities, I presume this would too...

Let's put those libraries in the new task as links and see if they're the best of if there are other options. Archived for 5 years sounds like it's asking for trouble though.

@TheLastProject
Copy link
Member

Oh yeah, that reminds me, I found https://developer.android.com/reference/android/graphics/pdf/PdfRenderer.html yesterday. PDF reading right in Android core libraries. That would definitely be the best option if possible.

But first it needs checking if Google's new Android 13 restrictions on opening files hasn't broken the ability to open non-media-files: #979

@ChildishGiant
Copy link

this would be a massive step forward for this app's actual use as a ticket manager as well as membership cards.

@brennoflavio
Copy link

I don't know if its an use case that this app is whiling to support, but currently in my country I can use PDF's with QR codes as valid documents (IDs, vaccination cards, car license etc).

So Catima has being a great way to concentrate all my documents, except that I can't attach the original PDF's to the document if some official asks for it. Currently I converted the PDFs to images and attached to Catima, but sometimes they ask for the PDF itself. So I'm saving that in my phone also, but would be great to have some sort of "Attachments" session that allows the user to upload stuff related to that card.

@andrearicci
Copy link

maybe we can just use an "attach" option, for any kind of document, wich opens a new app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common: uncommon Most users are unlikely to come across this or unexpected workflow severity: minor Impairs non-critical functionality or suitable workarounds exist type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants