Closed GoogleCodeExporter closed 8 years ago
Document works fine on the pdf.js viewer
(http://mozilla.github.com/pdf.js/web/viewer.html) in FF and Chrome. But not in
the PdfJs viewer in r1348.
Do you have any other examples that fail to render?
Original comment by will.abson
on 4 Dec 2012 at 5:03
Peter, any ideas? I wonder if updating to the latest pdf.js libs may fix this.
Original comment by will.abson
on 4 Dec 2012 at 5:04
I have narrowed it down to row 1565 in PdfJs.js
ctx.translate(-view[0] * this.parent.currentScale, -view[1] *
this.parent.currentScale);
The value of view[1] is way of, compared to other pdf:s this value is usually 0.
If I set a breakpoint on that row and manually set the view[1]=0 it renders as
expected.
I have however not been able to track down where that faulty value originates
from. It is not from pdf.js, I have updated that to the latest version from
github. So somewhere in our width calculations perhaps.
The view array is returned by PDFPageProxy in pdf.js, and that pageInfo.view
object row 1483 has values originating from our code? Since the same code works
on the github hosted viewer.
Original comment by loftux.p...@gmail.com
on 4 Dec 2012 at 8:53
I have now a workaround that the reporter can test if building from source,
change the line (it is not committed you would have to change yourself)-
//ctx.translate(-view[0] * this.parent.currentScale, -view[1] *
his.parent.currentScale);
-> change to
ctx.translate(0, 0);
Will, I have tested the above (not committed anything) on many different pdf:s
and it seems to work for all of them. I also added
Alfresco.logger.debug("CTX view " + view[0] + ' ' +view[1]);
to see what the standard value of view is, and in almost all cases it is 0. For
those pdf:s that it is not, it still renders as expected with the above change.
I did not commit this as it is just hiding the underlying issue.
I also noted that the preset zoom width calculations is wrong for this
particular pdf, that is probably also due to this pdf having the wrong width
settings.
Original comment by loftux.p...@gmail.com
on 5 Dec 2012 at 4:55
I made the change on PdfJs.js and PdfJs-min.js from media-viewers-2.0.jar and
it works fine ! Thanks
I also tried to do this modification on latest release from svn/trunk, but I
can't open any document anymore with that release.
I imported project into Eclipse, made the change on PdfJs.js and lanched
dist-jar Ant script.
Did I miss something ?
I attached my non working jar.
May I benefit of this issue to ask if, when I open a .pdf document, if the
document that is showned is the original one or a new pdf which has been
generated such as it is with .docx, pptx etc. ?
Original comment by philippe...@gmail.com
on 5 Dec 2012 at 10:35
Attachments:
Phillipe, please can you open a separate issue if you are still having
problems. Please check that you have followed the build instructions in the
README/wiki, and check for any errors in your server logs or web browser JS
console.
Original comment by will.abson
on 10 Dec 2012 at 1:41
Peter, I agree with your analysis. I could also not find a call to the
translate() method in pdf.js viewer.js, so I commented out the line in our
code. I found this caused the Purchase Order PDF to render fine and it did not
affect the others that I tested with.
I propose committing that simpler fix (comment out the line and add a note)
without the debug logging, if you are OK with me doing that?
Original comment by will.abson
on 10 Dec 2012 at 1:46
OK with that.
You may also need to implement a workaround for fixed zoom sizes. If you try
for example two page fit with this pdf you will see that the extreme value
reported by view array cause the size to be miniatures.
Original comment by loftux.p...@gmail.com
on 10 Dec 2012 at 2:32
This issue was closed by revision r1358.
Original comment by will.abson
on 10 Dec 2012 at 3:53
Created issue 117 to track the auto-zoom issue seen on the same test document.
Original comment by will.abson
on 10 Dec 2012 at 6:34
Original issue reported on code.google.com by
philippe...@gmail.com
on 30 Nov 2012 at 2:23Attachments: