Open guiann opened 13 years ago
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.
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
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);
}
Finally i found the problem. It is like a joke.
line 78
public static final boolean DEFAULTKEEPCACHES = false;
line 78
public static final boolean DEFAULTKEEPCACHES = true;
solves my problem.
@jblough thank you very much for all of your work.
if you change DEFAULTKEEPCACHES to true, you will have OutOfMemory issue.
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.
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 ?