mozilla :: #pdfjs

21 Apr 2017
14:00ktownheroI am using the PDF.js viewer embedded in a page in my web app.
14:00ktownheroI recently upgraded to the newest built version (I was on a very old version before)
14:00ktownheroI make the call PDFViewerApplication.open(bytes) to render the PDFs
14:01ktownheroEventually at some point the viewer stops working entirely for all users and instances of the web app, the ajax error I get is that PDFViewerApplication is not defined
14:01ktownheroA restart of Tomcat doesn't fix it, only a full redeployment of my webapp -- then it seems to work for a day or so and the same thing happens.
14:01ktownheroMy call to PDFViewerApplication occurs in a small method that I placed in viewer.html
14:02ktownheroAny thoughts or ideas as to what I can do to resolve this?
15:18yuryktownhero: can you provide link to your deployment?
15:19yuryktownhero: do you use generic build or you are trying to use development version as is?
15:19ktownheroIt's not a public app
15:19ktownheroI used the generic build -- I used to use the development version but I was way behind
15:20yuryktownhero: please create a sample public example with same problem, it's hard to tell what you are experiencing with tomcat
15:21yuryktownhero: or at least guide is details how to setup the exact environment you have (please test your steps)
15:22yurylink to the public site will be preferable
16:14mukulyury: Hi
16:18yuryHi
16:19mukulI tired to prototype extractTextContent http://jsbin.com/bobekehepa/edit?js,console
16:35yurya se
16:37yurymukul: it looks good
16:38mukulyury: using this way, i think enqueue of data does not depends upon pull
16:38yurymukul: check i you can delay read by 3 sec
16:38yuryread()
16:39yuryor readAll
16:39yuryI think you will see size calls
16:39mukulyes, in this console.log in size is working
16:41yurygood, change getTextContent to have the pilot code
16:41yurythen we will mix in onPull and size
16:43mukulshould i create a new branch or just change in streams-getTextContent
16:44yurychange streams-getTextContent
16:48yuryat the end it will be large patches and you will need to explain that to the reviewer again :)
16:49* yury will ask bdahl to review all that :)
16:49mukulThen i think i have to write it somewhere :)
16:50yurysure, you just look at irc logs
16:51mukulyes, this can also be one of the options
16:52yuryor add really good comments
16:53* yury thinks that `/* add one to i */ i = i + 1;` is not a good comment
16:54mukulyes, sure :-D
16:54mukulsome descriptive comment may help
18:05mukulyury: for now we can't post start_complete
18:05mukulbecause action handler is returning promise
18:05yurywhy?
18:05mukul*not
18:06yuryWrap return result with `Promise.resolve()`
18:06yurySo it will not matter if promise returned or not
18:06mukulah, yes.
18:06mukulDoes it matter if we return nothing?
18:34yurymukul: Promise.resolve(undefined) will make a promise from it
18:35yuryand having possible async return matters from start, pull or cancel operations
18:42mukulyury: okay, i have modified the streams-getTextContent brach
18:42mukulhttps://github.com/mukulmishra18/pdf.js/commit/3515b060e6a8bab3491d3c74e3309e082b8fb18f
19:06yurymukul: looks reasonable (I would remove `throw reason;` -- nothing will handle it)
19:07mukulsure
19:07mukulbut actually i have problem
19:07mukulit is not returning all textContent
19:09mukuli tried this code for a PDF having 3 styles, but this only returns 2
19:12yurythat is a problem yes
19:14mukulhow we are going to solve it? why it is happening?
19:16yurynot sure
19:16yurymukul: are you sending last chunk?
19:17yurymukul: extract enuque and cleaning into separate function and this call this when loop is done
19:18yurytask is done
19:22mukulso i have to call this function for each iteration of while loop?
19:26mukulI think you mean i have to call this function at next and when promiseBody function is resolve
19:26mukulto get the last chunk
19:27mukulHmm...., it is working
19:29yurymukul: you will also need to call it before promiseBody calls getTextContent for sub-from
19:29* yury did not want to mention it now
19:38mukulyou mean here https://github.com/mozilla/pdf.js/blob/master/src/core/evaluator.js#L1700 ?
19:39yurycorrrect
19:40yurywhy not send everything back instead of adding to the callers items
19:46mukul^^^ what that mean actually?
19:47yurysee https://github.com/mozilla/pdf.js/blob/master/src/core/evaluator.js#L1704-L1705
19:48mukulthen you mean instead of appending to textContent we can directly enqueue into sink
19:52yurycorrect
19:52yury(we can probably disable caching for now though)
19:55mukulIf we do this, then we don't need to call function to enqueue the chunk?
19:57yuryif you will not call, chunks will be out of order
20:30mukulyury: i made some modification according to your above comments in streams-getTextContent branch
20:30mukulhttps://github.com/mukulmishra18/pdf.js/commit/faea725617204586bf69ef26655f260eaf360aff
22 Apr 2017
No messages
   
Last message: 155 days and 21 hours ago