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

multiple problems on page rendering. #1

Open
guiann opened this issue Oct 6, 2011 · 5 comments
Open

multiple problems on page rendering. #1

guiann opened this issue Oct 6, 2011 · 5 comments

Comments

@guiann
Copy link

guiann commented Oct 6, 2011

Hi !

I'm really interested in this project,

did you have good result so far ?

I cannot render pdf pages, it gives me a lot of

com.sun.pdfview.PDFParseException: Expected a number here.
java.nio.BufferUnderflowException
java.lang.NullPointerException

this is not crashing down the app but the page is never fully rendered : there is missing text or missing picture on each page and at random position...

can I send you a pdf file so you could try on it and maybe fix this problem ?

@jblough
Copy link
Owner

jblough commented Oct 10, 2011

Unfortunately, this project mainly just wrapped an existing PDF rendering library so I don't know much about the internals. If you can attach a sample PDF or put it somewhere that I can download it, I'll be glad to take a look though and see if I can figure it out.

@BarisCirika
Copy link

I have same problem. But it don't give exception. (In AlternateColorSpace class fcomp[3] is not available).
Look at that class maybe solve your exception. My Solution is

AlternateColorSpace CLASS

Original Code

@Override
public int toColor(float[] fcomp) {

    float average = 0;
    if (function != null) {
        // translate values using function
        fcomp = function.calculate(fcomp);
    }
    float k = fcomp[3];
    float w = 255 * (1 - k);
    float r = w * (1 - fcomp[0]);
    float g = w * (1 - fcomp[1]);
    float b = w * (1 - fcomp[2]);
    return Color.rgb((int) r, (int) g, (int) b);
}

My Code

@Override
public int toColor(float[] fcomp) {

    float average = 0;
    float k;
    if (function != null) {
        // translate values using function
        fcomp = function.calculate(fcomp);
    }
    //checks fcomp lenght...
    if (fcomp.length <= 3) {
        //this is not a good solution
        k = 1;
    }
    float w = 255 * (1 - k);
    float r = w * (1 - fcomp[0]);
    float g = w * (1 - fcomp[1]);
    float b = w * (1 - fcomp[2]);
    return Color.rgb((int) r, (int) g, (int) b);
}

@BarisCirika
Copy link

Finally i found the problem. It is like a joke.

PdfViewerActivty

Original code

line 78

public static final boolean DEFAULTKEEPCACHES = false;

My Code

line 78

public static final boolean DEFAULTKEEPCACHES = true;

solves my problem.

@jblough thank you very much for all of your work.

@kinhbang89
Copy link

if you change DEFAULTKEEPCACHES to true, you will have OutOfMemory issue.

@myke91
Copy link

myke91 commented Dec 9, 2015

I included the PdfViewer.jar in my project and extended, so I only have the .class and I can't make the change in there. Please how do I change the DEFAULTKEEPCACHES to true. I'm sorry if this question is trivial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants