screenshot-to-code icon indicating copy to clipboard operation
screenshot-to-code copied to clipboard

Support uploading pdfs

Open NaorFirefly opened this issue 1 year ago • 14 comments

Hi, would that be possible? Thanks

NaorFirefly avatar Nov 20 '23 13:11 NaorFirefly

Can you share your use case? What is it that you're looking to convert?

Looking to support.

abi avatar Nov 20 '23 14:11 abi

A pdf of text mixed with graphics just to text Each page should be converted to an image Then to html And then unify pdf

On Mon, 20 Nov 2023 at 16:26 Abi Raja @.***> wrote:

Can you share your use case? What is it that you're looking to convert?

Looking to support.

— Reply to this email directly, view it on GitHub https://github.com/abi/screenshot-to-code/issues/52#issuecomment-1819167370, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWJQXWT2MJYSPQ3ASHI5BRTYFNSDBAVCNFSM6AAAAAA7S5IGIWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJZGE3DOMZXGA . You are receiving this because you authored the thread.Message ID: @.***>

NaorFirefly avatar Nov 20 '23 15:11 NaorFirefly

@NaorFirefly thanks. What kind of PDFs are they?

abi avatar Nov 20 '23 17:11 abi

Magazine for example. So when I do it manually it works very well Just screenshot per page, then I input to the tool, get HTML, ask "without pictures, one column", then I download the HTML, convert to PDF (with printing into PDF), and then unify the PDFs. Then I convert to EPUB and I have a magazine of PDF -> EPUB ready for Kindle.

On Mon, Nov 20, 2023 at 7:51 PM Abi Raja @.***> wrote:

@NaorFirefly https://github.com/NaorFirefly thanks. What kind of PDFs are they?

— Reply to this email directly, view it on GitHub https://github.com/abi/screenshot-to-code/issues/52#issuecomment-1819542091, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWJQXWQ5D7OUCMX427T353DYFOKC3AVCNFSM6AAAAAA7S5IGIWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJZGU2DEMBZGE . You are receiving this because you were mentioned.Message ID: @.***>

NaorFirefly avatar Nov 20 '23 18:11 NaorFirefly

Before supporting PDF upload, multi-image upload should be supported given that PDF typically contains more than one image.

clean99 avatar Nov 21 '23 01:11 clean99

@NaorFirefly that workflow makes sense. I'm not going to work on this but others are free to take this up. Should be relatively easy to add.

@clean99 makes sense. For PDF, there should be a bunch of JS libraries like pdf.js that should be able to convert PDF into a set of images.

abi avatar Nov 21 '23 02:11 abi

Can you at least add the multi image upload? The other parts are easy

On Tue, 21 Nov 2023 at 4:30 Abi Raja @.***> wrote:

@NaorFirefly https://github.com/NaorFirefly that workflow makes sense. I'm not going to work on this but others are free to take this up. Should be relatively easy to add.

@clean99 https://github.com/clean99 makes sense. For PDF, there should be a bunch of JS libraries like pdf.js that should be able to convert PDF into a set of images.

— Reply to this email directly, view it on GitHub https://github.com/abi/screenshot-to-code/issues/52#issuecomment-1820115977, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWJQXWXHZ65VEAB3EELVPHDYFQG5DAVCNFSM6AAAAAA7S5IGIWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRQGEYTKOJXG4 . You are receiving this because you were mentioned.Message ID: @.***>

NaorFirefly avatar Nov 21 '23 03:11 NaorFirefly

@abi I want to work on this issue. Just needed clarifications on a couple of things.

Issue: Currently the application does not support pdf uploads.

Possible Solution: First of all, add support to upload pdfs which in turn will convert the each page to a separate image.

We can do this on frontend or backend. Let me know which one you'd prefer. I would suggest just giving multi image support to the frontend to begin. Then we might have to generate results for each image separately because of the limited context for openAI API.

PiyushMishra318 avatar Nov 21 '23 04:11 PiyushMishra318

Multi-image sounds great to begin with!! thank you

On Tue, Nov 21, 2023 at 6:23 AM Piyush Mishra @.***> wrote:

@abi https://github.com/abi I want to work on this issue. Just needed clarifications on a couple of things.

Issue: Currently the application does not support pdf uploads.

Possible Solution: First of all, add support to upload pdfs which in turn will convert the each page to a separate image.

We can do this on frontend or backend. Let me know which one you'd prefer. I would suggest just giving multi image support to the frontend to begin. Then we might have to generate results for each image separately because of the limited context for openAI API.

— Reply to this email directly, view it on GitHub https://github.com/abi/screenshot-to-code/issues/52#issuecomment-1820217949, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWJQXWQKO3DKO4MO3K7MOQTYFQUCXAVCNFSM6AAAAAA7S5IGIWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRQGIYTOOJUHE . You are receiving this because you were mentioned.Message ID: @.***>

NaorFirefly avatar Nov 21 '23 07:11 NaorFirefly

@PiyushMishra318 I would start with the simplest thing possible: accept multiple images and send them all in one request. Let's not worry about context for now. Input is 128K and output is 4K so input is really not a concern.

abi avatar Nov 21 '23 16:11 abi

@abi Got it. I'll submit a PR in a couple days.

PiyushMishra318 avatar Nov 22 '23 05:11 PiyushMishra318

Hi @PiyushMishra318 any news? Cheers

NaorFirefly avatar Nov 26 '23 09:11 NaorFirefly

@NaorFirefly You can follow #84 for updates.

PiyushMishra318 avatar Nov 27 '23 11:11 PiyushMishra318

I will take a look shortly.

abi avatar Nov 27 '23 14:11 abi