pdf.js icon indicating copy to clipboard operation
pdf.js copied to clipboard

Feature plans?

Open cayblood opened this issue 15 years ago • 16 comments

Could you please post some plans for what kinds of features you think you will implement? We have some forms and table-based reports generated by prawn that we would like to be able to render entirely on the client side with js. Thanks!

cayblood avatar Jul 06 '10 20:07 cayblood

I think the biggest current issue is finding a way to turn HTML into Postscript.

http://github.com/Marak/pdf.js/issues#issue/1

If you have ANY ideas on an approach to solve this, I would be more then happy to investigate and try to implement.

Marak avatar Jul 06 '10 20:07 Marak

Sounds like you need to basically port webkit to js. This is a non-trivial problem.

cayblood avatar Jul 06 '10 20:07 cayblood

To my (limited) understanding, yes you need something like that.

Marak avatar Jul 06 '10 21:07 Marak

I think a more reasonable goal would be to implement some basic reporting features instead of an arbitrary dom rendering engine.

cayblood avatar Jul 06 '10 21:07 cayblood

That's not a terrible idea....

Do you mean like "hardcode" some functionality for creating basic reporting features like tables and columns or something?

It seems like it could be a dangerous road though. Eventually, you will wind up rebuilding HTML?

Do you have any concrete examples of what you'd like to see? If you can provide some pseudo code I might be able to get a proof of concept going before end of week.

Marak avatar Jul 06 '10 21:07 Marak

I was thinking of something like this:

http://prawn.majesticseacreature.com/

except in js instead of ruby.

cayblood avatar Jul 06 '10 21:07 cayblood

totally. i can try to research into this library a bit to see how it works, but if you could provide any more details on an actual plan of attack, that would be way better for me.

i wasn't planning on adding any new features to this library anytime soon, but if there is the need for additional functionality and we have a solid plan on how to implement it, i'll be happy to put in the development hours.

Marak avatar Jul 06 '10 21:07 Marak

I appreciate the willingness to work on it. My initial take is that the philosophy of splitting off the library into concerns makes sense. Prawn is divided into the core, layout and security components. Core seems to deal with some of the basic fundamentals of postscript/pdf rendering. Layout seems to deal with how to place things, change fonts etc. Security deals with password protection and stuff.

I would suggest taking the approach of creating the same kind of components. One core abstraction layer to eliminate the tediousness of generating the PDF. Another to manage layout issues. Forget about password protection for the time being.

However, there's no doubt that this is a challenging problem. There's a lot involved here. But looking at the Prawn source could definitely save a ton of time.

cayblood avatar Jul 06 '10 21:07 cayblood

maybe i could try to get http://github.com/sandal/prawn/blob/master/examples/table/simple_table.rb working as a proof of concept?

Marak avatar Jul 07 '10 00:07 Marak

It's up to you. Whatever you think is best.

cayblood avatar Jul 07 '10 12:07 cayblood

you mentioned forms and table based reports?

i'm assuming you have a specific use case in mind? could you provide any dummy html templates or fragments i can test against? are there any components or specific pieces of Prawn you'd like to see implemented first? can you provide any other specifics? is there a specific date you are looking to get this implemented by?

the more information i have, the better!

Marak avatar Jul 07 '10 15:07 Marak

Thanks Marak. Actually this is more of a someday/maybe project. We have already released a version that relies on prawn and ruport. I have thought about redoing it in HTML5/CSS/javascript entirely and doing away with the server component. But this will not happen soon. I asked initially just to see if you had any future plans with the project. Sorry for the false alarm.

cayblood avatar Jul 07 '10 15:07 cayblood

cayblood -

got ya. well just let me know if you'd like to move forward. i might attempt to implement these features, but without an immediate need for this functionality i'm more inclined to wait and see if anyone steps up with a pure JS rendering engine that will allow us to take HTML => PostScript (which we can convert to PDF)

let me know if / when you feel like working on this and i'll see what i can do.

-marak

Marak avatar Jul 07 '10 15:07 Marak

I may be missing something, but I think that such a library is not going to be happening any time soon. As far as I can tell, postscript is so different from DOM rendering that it would require a lot of supporting code. All the other libraries I've seen that convert HTML to PDF essentially have a rendering engine built into them somewhere along the stack.

cayblood avatar Jul 07 '10 15:07 cayblood

Maybe we could plumb node into a headless open office instance. I haven't tried it but I started a little research:

http://user.services.openoffice.org/en/forum/viewtopic.php?f=16&t=28862

http://user.services.openoffice.org/en/forum/viewtopic.php?f=44&t=34451&p=159684&hilit=headless#p159684

http://user.services.openoffice.org/en/forum/viewtopic.php?f=7&t=32891&p=150822&hilit=headless#p150822

metamindxx avatar Nov 22 '10 15:11 metamindxx

hi mark... do you have some solution regarding insertion of image in the pdf file....

thanks in advance

suyogs avatar Mar 01 '11 11:03 suyogs