pascoual / meteor-pdfkit

Create PDF with PDFKit node package on your Meteor application.
40 stars 7 forks source link

upgrade to PDFkit version 0.7.1 #18

Closed jindrichbartek closed 9 years ago

jindrichbartek commented 9 years ago

Hi, it would be nice to upgrade this meteor wrapper package to last PDFkit version.

Current version doesn't support 'Switching to previous pages' feature. That's mean bufferPages: true in constructor, doc.switchToPage(pageNumber) method etc.

Btw. I've tried that localy, but there is some error with finalize method here: https://github.com/pascoual/meteor-pdfkit/blob/master/pdfkitWrapper.js#L9.

pascoual commented 9 years ago

Got the same error, I will try to find why. If some one has an idear, tell it here :).

joadr commented 9 years ago

Just created a pull request that fixes this. I didn't have time to test it for saving files locally, but should it should work fine.

pascoual commented 9 years ago

Too much changes in PDFKit to update this package without breaking compatibility with the actual version.

I cannot guarantee the synchronization of operation using the new PDFKit streamed solution. I need to read more about the implementation to know if doc.end() is synch, blocking or not but synch. If following code use the created file and the write process is not ended, could create trouble.

Also, I've read on new PDFKit version

Style open issues :(

So?

I will create a new Meteor package with PDFKit 0.7.1 and keep this one for critical server PDF generation. The new package will be server & client side as this is a new functionality of PDFKit :) !

joadr commented 9 years ago

PDFKit's API is synch, check this out: https://github.com/devongovett/pdfkit/issues/269#issuecomment-52732422

tom-on-the-internet commented 9 years ago

Client side generation? Amazing! This is exactly what I need. When do you expect the new package? I can't believe I stumble upon this right before starting up a big (for me) job!

pascoual commented 9 years ago

@joadr sure ?

but one issue I've run into is making sure the entire buffer is written before closing the streams and zipping up. The issue touched on in your second point is what has caused me to check _writeableState on a setInterval which ain't pretty :)

@thomaspatricksteven if I found time, this week-end

pascoual commented 9 years ago

The PDFKit 0.7.X package is here: pascoual:PDFKitX

The meteor client side is not so easy to do. Need more time, or help ;), contributions are welcome.

As said, the current pascoual:pdfkit version will continue to be used for server side only and better performance use cases.

pascoual commented 9 years ago

The PDFKit 0.7.X package is here: pascoual:PDFKitX

Client side ok !