Stream PDF to another local App

Posted by Nathan on Stack Overflow See other posts from Stack Overflow or by Nathan
Published on 2010-04-29T15:20:55Z Indexed on 2010/04/29 15:27 UTC
Read the original article Hit count: 278

Hi, I'm currently trying to optimize a small firefox extension that will grab a pdf off the current document and send it to a port that another local application is listening on.

Right now it uses a terrifying hackjob of cache viewer. The way I'm getting it is loading the cache, searching through it using the current URL and grabbing the file and saving it to a temp directory. Then I stream the file in, delete the temp, and send it through the socket.

Now, my new design, ideally I'd want to build it from scratch and cut out saving it to the local machine at all, and just stream it through the socket. I've been looking at doing something like,

//check page to ensure its a pdf
//init in/out streams
//stream through sock
//flush

Now, this would be vastly superior to the 400 line hacked up mess I have now, but I'm new to building FF extensions, and after reading a lot about URIs and the file streaming and such I'm probably more confused than when I started trying to fix this three hours ago.

I'm okay with sending things through the sockets and whatnot, I understand that, I'm mainly confused about what multitude of interfaces I want to use.

Gah! Thanks! Also, long time reader, first time poster!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about firefox