[NEW] PDF message attachment preview (client side rendering)#10519
[NEW] PDF message attachment preview (client side rendering)#10519ggazzo merged 7 commits intoRocketChat:developfrom
Conversation
|
@kb0304 can you link to your repository where the worker code lives? That way we can review that code as well? Thanks! |
|
@graywolf336 Sure, here's the link |
|
Not sure how I feel about this. Why are you only committing the build files and not the source files? Why not create a new package inside of Rocket.Chat if there's no real documentation for other projects to use your source code? |
|
@graywolf336 I initially used pascoual:pdfjs, but since the version of pdf.js used is outdated and it no longer seems to be maintained I made a wrapper myself and used it. Documentation, examples to use it are available here |
|
Any news here? That's a very nice feature. |
| import _ from 'underscore'; | ||
| import moment from 'moment'; | ||
|
|
||
| pdfjsLib.GlobalWorkerOptions.workerSrc = '/packages/kb0304_pdfjs/build/pdf.worker.js'; |
There was a problem hiding this comment.
This path can cause some troubles if Rocket.Chat is running under a root URL with a subdirectory.
|
|
||
| Template.message.onViewRendered = function(context) { | ||
| return this._domrange.onAttached(function(domRange) { | ||
| return this._domrange.onAttached((domRange) => { |
There was a problem hiding this comment.
@ggazzo Do you know if Meteor provides a public method to access this property?
|
Any news on this? Looks like a very helpful addition to the Rocket.Chat! |
|
This pull-request started crashing Safari 12, I cannot share the GIF here because there's sensitive information on it, but I shared with the internal team already. |
|
Does this feature needs to be enabled somewhere in the administration settings? |
|
I have the same issue. Does not seem to work with latest stable. |
|
Tested on my own 0.71.1 test setup and on https://openrocket.chat/general |
|
The reason the pdf preview no longer works is that it was broken by PR #12375. An extra test was added to disable the preview in safari versions <= 12. That also affects Chrome (which may or may not be intentional). In addition the original first line of 'renderPdfToCanvas' was changed to use a regular expression but a '!' was omitted, which stops it ever producing a preview. It should read: |
Preview of PDF files
Rendering first page on a canvas using a
Workeron client sideCloses #2741
