Skip to content

Rendering error, some text flipped across page #5946

Closed

Description

@jethrogb

In Firefox 36.0.1 / Ubuntu 14.04:
screen shot 2015-04-17 at 14 17 22

The header text "Advising Review Checklist" is flipped and on the bottom of the page. Same issue using Firefox 37.0.1 / Mac OS X Mavericks

Compare Adobe Reader 9.5.5 / Ubuntu 14.04:
screenshot from 2015-04-17 14 19 17

Source file: https://jbeekman.nl/github-mozilla-pdf.js-issue-5946.pdf

Activity

  1. dacsy commented on Nov 26, 2015

    @dacsy

    Is there any information about this yes ?
    I am having this issues also

  2. jethrogb commented on Nov 26, 2015

    @jethrogb
    Author

    I have yet to see a PDF.js bug I reported fixed.

  3. dacsy commented on Nov 26, 2015

    @dacsy

    Which version are you talking about ? I got the latest version: 1.2.109 and I still get the problem

  4. THausherr commented on Nov 30, 2015

    @THausherr
    Contributor

    A possible hint... there's a bug in the PDF specification: 12.5.5 Appearance Streams. Text is "Matrix shall be concatenated with A to form a matrix AA" should be "Matrix shall be concatenated to A to form a matrix AA" and the formula below must be changed too. This has been confirmed to me by somebody who has the PDF 2.0 specification.

  5. THausherr commented on Dec 11, 2015

    @THausherr
    Contributor

    I believe I found the cause and it is not related to my remark above. I modified the first file and enclosed the page content stream within q...Q, i.e. so that after rendering the page content, the graphics attributes would be reset to their original settings, and now this file and the one from #4743 (with the code change mentioned by @Osukaru) are properly displayed.

    So a code change would be needed that resets something before rendering annotations.

    The modified files:
    http://www.filedropper.com/pdfjs-5946unc
    http://www.filedropper.com/test-signatureunc

  6. THausherr commented on Dec 11, 2015

    @THausherr
    Contributor

    This code in core.js:

          return Promise.all([pageListPromise, annotationsPromise]).then(
              function(datas) {
            var pageOpList = datas[0];
            var annotations = datas[1];
    
            if (annotations.length === 0) {
              pageOpList.flush(true);
              return pageOpList;
            }
    
            var annotationsReadyPromise = Annotation.appendToOperatorList(
              annotations, pageOpList, partialEvaluator, task, intent);
            return annotationsReadyPromise.then(function () {
              pageOpList.flush(true);
              return pageOpList;
            });
          });
        },
    

    if I've understood this correctly, you are creating a big list of operators with their parameters from the page content stream(s) and the content streams of the annotations. So if the page content stream(s) end with a flipped CTM (here: 1 0 0 -1 0 792 cm), the annotations will "inherit" that.

  7. timvandermeij commented on Dec 26, 2015

    @timvandermeij
    Collaborator

    I'm a bit confused about this issue. We have https://github.com/mozilla/pdf.js/blob/master/src/display/canvas.js#L1839-L1846 which should take care of resetting the state already. I also tried adding explicit save and restore operators around beginAnnotations and endAnnotations at https://github.com/mozilla/pdf.js/blob/master/src/core/annotation.js#L396-L400, but also without luck. While @THausherr's explanation is very likely, I'm unsure why these changes have no effect. The issue does appear to be not properly resetting the state before drawing annotations, but I don't know of anything more we have for canvas drawing to achieve that if the current code is not doing that.

    @yurydelendik @Snuffleupagus Do you perhaps have an idea for the above? It is affecting multiple PDFs in open issues, so it would really be nice to have this resolved.

  8. THausherr commented on Dec 26, 2015

    @THausherr
    Contributor

    What I meant is to save and restore before and after the main content stream. It is the main content stream that is the problem, i.e. if the main content stream doesn't reset all changes it has done.

    I don't know enough about javascript, I remember you have some list of all operators with their parameters, ideally OPS.save should be inserted before everything, and OPS.restore at the end of the list, all that before you add the annotation content streams.

  9. Snuffleupagus commented on Dec 28, 2015

    @Snuffleupagus
    Collaborator

    @jethrogb Are you the creator of the PDF file (https://jbeekman.nl/github-mozilla-pdf.js-issue-5946.pdf), and if so may we include it in the test-suite?

  10. jethrogb commented on Dec 28, 2015

    @jethrogb
    Author

    I'm not, and I don't know. I can try to get permission, but it'd be easier if you could recreate the test case.

  11. Mirich2 commented on Aug 31, 2022

    @Mirich2

    I believe I found the cause and it is not related to my remark above. I modified the first file and enclosed the page content stream within q...Q, i.e. so that after rendering the page content, the graphics attributes would be reset to their original settings, and now this file and the one from #4743 (with the code change mentioned by @Osukaru) are properly displayed.

    So a code change would be needed that resets something before rendering annotations.

    The modified files: http://www.filedropper.com/pdfjs-5946unc http://www.filedropper.com/test-signatureunc

    hey i have the same problem as stated above my electronic signature when viewed is seen upside down im in need of the modificatios you posted since the links are down if possible thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions