jsPDF icon indicating copy to clipboard operation
jsPDF copied to clipboard

Problem with PNG Compression in Adobe Acrobat

Open MrRio opened this issue 10 years ago • 32 comments

I just tried the newest build dist min and getting an error when opening a document in Adobe Acrobat. "There was an error processing a page. There was a problem reading this document (110)." Ironically, opening the PDF within Chrome works fine, but opening it with Adobe causes the error. Any ideas?

See https://github.com/MrRio/jsPDF/pull/852#issuecomment-249667116

MrRio avatar Sep 28 '16 23:09 MrRio

CC @buenjybar

MrRio avatar Sep 28 '16 23:09 MrRio

Hi, what is the timeframe for this issue?

Edit: I found the fix, i will make a pull request tonight.

getPredictorFromCompression = function getPredictorFromCompression(compression) {
        var predictor;
        switch (compression) {
            case jsPDFAPI.image_compression.FAST:
                predictor = 11;
                break;

            case jsPDFAPI.image_compression.MEDIUM:
                predictor = 13;
                break;

            case jsPDFAPI.image_compression.SLOW:
                predictor = 14;
                break;

            default:
                predictor = 12;
                break;
        }
        return predictor;
    },

Pe46dro avatar Oct 03 '16 14:10 Pe46dro

Is this fixed? I am having a similar issue with adobe acrobat reader dc version 2015.017.20053 with the attached file. Thanks. test.pdf

nnylip avatar Oct 10 '16 18:10 nnylip

@nnylip Can you send me the image you have embedded? I'll write up a test case!

MrRio avatar Oct 10 '16 20:10 MrRio

I've created a test case, it renders fine in Firefox and Chrome, but not Acrobat DC

https://github.com/MrRio/jsPDF/blob/bugfix/png/tests/readers/reference/broken-png-2.pdf

Steps to reproduce:

npm run local-test # run this once
rm ./tests/readers/reference/broken-png-2.pdf
./node_modules/.bin/karma run -- --grep="render transparent PNG"
open -a Adobe\ Acrobat\ Reader\ DC ./tests/readers/reference/broken-png-2.pdf

MrRio avatar Oct 11 '16 02:10 MrRio

The test program that created pdf is attached (image is changed as client might object), it uses htm2canvas, also thanks so much for help - Lou

On 10/10/2016 05:00 PM, James Hall wrote:

@nnylip https://github.com/nnylip Can you send me the image embedded? I'll write up a test case!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MrRio/jsPDF/issues/862#issuecomment-252744827, or mute the thread https://github.com/notifications/unsubscribe-auth/APNHCmKoNyeaOsu3D39CQ73Wwfvog2qXks5qyqdUgaJpZM4KJaaE.

nnylip avatar Oct 11 '16 02:10 nnylip

Hey @diegocr @jamesbrobb any idea what the issue here might be? Renders ok in Chrome. screen shot 2016-10-11 at 03 14 26

MrRio avatar Oct 11 '16 02:10 MrRio

Anything happening with this?

nnylip avatar Oct 12 '16 13:10 nnylip

Currently looking into it!

MrRio avatar Oct 18 '16 10:10 MrRio

Did you check the latest code ? it seems that it was fixed with #801 & #871
if you replace " <</Predictor undefined " with " <</Predictor 13 "

buenjybar avatar Oct 20 '16 19:10 buenjybar

This issue started happening to me after updating from version 1.2.61 to 1.3.2. PDF is opened in Chrome but not in Adobe Acrobat Reader, gives 110 error. Rolled back to version 1.2.61 solved it for now.

ido172 avatar Oct 25 '16 11:10 ido172

So how can I get this fixed? I am having the same problem @ido172 ?

edisonramaa avatar Oct 25 '16 11:10 edisonramaa

@edisonramaa i'm also waiting for a fix. i just Installed version 1.2.61 instead of 1.3.2. The error doesn't appear to exist there

ido172 avatar Oct 25 '16 12:10 ido172

Try to download the library from here not by release of NPM, i just used it and it don't create any type of problem with Adobe. The NPM package and the release download have an old version of the library before my PR (#871).

Pe46dro avatar Oct 25 '16 12:10 Pe46dro

@MrRio should make a new release to fix the problem

Pe46dro avatar Dec 21 '16 21:12 Pe46dro

@MrRio we're waiting for release, can we help you with this?

havenchyk avatar Jan 10 '17 16:01 havenchyk

Thank you @Pe46dro!

nahomtefera avatar Jan 21 '17 23:01 nahomtefera

i have overwriten the dist folder of the npm files in node_modules with the ones from https://github.com/MrRio/jsPDF/archive/master.zip then it worked. Thanks @Pe46dro I have one more question, it works on chrome,firefox,but not as expected on safari. On safari it opens the blob in a new tab in the browser with wrong layout, it takes full with and wraps my rows.Is that normal on safari,is there a workaround? This is how it looks in safari: image

And this is how it should look(like it does with adobe reader opening the file on chrome or firefox). image

stefanaerts avatar Jan 25 '17 13:01 stefanaerts

@stefanaerts This might be an issue from Safari PDF Reader. The one to trust is the Adobe PDF Reader. if no error is raised at the opening of the file this means the PDF is correct. I will recommend to check with this online tool : https://www.pdf-online.com/osa/validate.aspx if the result is not correct it will be nice if you could share your pdf to dig into the issue.

buenjybar avatar Jan 27 '17 15:01 buenjybar

it's ok,safari works fine.

stefanaerts avatar Jan 27 '17 16:01 stefanaerts