Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with PNG Compression in Adobe Acrobat #862

Closed
MrRio opened this issue Sep 28, 2016 · 32 comments
Closed

Problem with PNG Compression in Adobe Acrobat #862

MrRio opened this issue Sep 28, 2016 · 32 comments

Comments

@MrRio
Copy link
Member

MrRio commented Sep 28, 2016

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 #852 (comment)

@MrRio
Copy link
Member Author

MrRio commented Sep 28, 2016

CC @buenjybar

@Pe46dro
Copy link
Contributor

Pe46dro commented Oct 3, 2016

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 Pe46dro mentioned this issue Oct 3, 2016
@MrRio MrRio closed this as completed in 12c0832 Oct 3, 2016
@nnylip
Copy link

nnylip commented Oct 10, 2016

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

@MrRio MrRio reopened this Oct 10, 2016
@MrRio
Copy link
Member Author

MrRio commented Oct 10, 2016

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

@MrRio
Copy link
Member Author

MrRio commented Oct 11, 2016

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

@nnylip
Copy link

nnylip commented Oct 11, 2016

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
#862 (comment), or mute the thread
https://github.com/notifications/unsubscribe-auth/APNHCmKoNyeaOsu3D39CQ73Wwfvog2qXks5qyqdUgaJpZM4KJaaE.

@MrRio
Copy link
Member Author

MrRio commented Oct 11, 2016

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

@nnylip
Copy link

nnylip commented Oct 12, 2016

Anything happening with this?

@MrRio
Copy link
Member Author

MrRio commented Oct 18, 2016

Currently looking into it!

@buenjybar
Copy link
Contributor

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

@ido172
Copy link

ido172 commented Oct 25, 2016

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.

@edisonramaa
Copy link

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

@ido172
Copy link

ido172 commented Oct 25, 2016

@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

@Pe46dro
Copy link
Contributor

Pe46dro commented Oct 25, 2016

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
Copy link
Contributor

Pe46dro commented Dec 21, 2016

@MrRio should make a new release to fix the problem

@havenchyk
Copy link
Contributor

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

@nahomtefera
Copy link

Thank you @Pe46dro!

@stefanaerts
Copy link

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

@buenjybar
Copy link
Contributor

@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.

@stefanaerts
Copy link

it's ok,safari works fine.

@codeReadyy
Copy link

codeReadyy commented Feb 14, 2017

Hi All, I am facing the similar issue. I have created a Plunkr to demonstrate this issue. I have tried with both the version 1.2.61 and 1.3.2, but both version showing some different behavior.
When using 1.2.61, jsPDF not able to render html text content in IE only(Probably due to a image).
When using 1.3.2, Adobe is throwing 110 error.

@buenjybar any suggestions.

@codeReadyy
Copy link

Thank you @Pe46dro !! Waiting for release.

@robpolak
Copy link

any update on this issue?

@itsamayo
Copy link

itsamayo commented Feb 23, 2017

@codeReadyy @robpolak
If you're using the latest CDN (1.3.2) you can do the following as a fix.

  1. Create your own local jspdf.js file, copy the contents of the CDN into said file.
  2. Find the getPredictorFromCompression function (line 8342)
  3. Replace function with the below:
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;
    },
  1. Replace CDN reference in index with new jspdf.js file
  2. Viola

@Ant248
Copy link

Ant248 commented Mar 7, 2017

Hey still getting the same issue with he latest download of jspdf, looks like that code has been implemented but still receiving error 101 on acrobat reader :(

@itsamayo
Copy link

itsamayo commented Mar 7, 2017

@Ant248 The current release is missing the default in the switch statement. Use the solution I posted above to fix until the release is updated

@Ant248
Copy link

Ant248 commented Mar 7, 2017

Thanks! Odd i have this in my release:

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;

Seems to be what you have posted?

@cxrod
Copy link

cxrod commented Mar 23, 2017

@Ant248 The current release (1.3.3) still have this issue! I just follow @AshKetchumza instructions with previous version (1.3.2) and it works perfectly!

@chamsmarena
Copy link

The 110 error comes when you add PNG image on the document

@buenjybar
Copy link
Contributor

Note: version 1.3.4 doesn't have this PNG compression issue.

@brgoggin
Copy link

Indeed, version 1.3.4 seems to not have this issue.

@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 17, 2018

Then it is officially fixed. :)

@Uzlopak Uzlopak closed this as completed Feb 17, 2018
@parallax parallax deleted a comment from lavish-idexcel Oct 3, 2018
@parallax parallax locked as spam and limited conversation to collaborators Oct 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests