a7mdfm / alivepdf

Automatically exported from code.google.com/p/alivepdf
1 stars 0 forks source link

Result PDF file of servlet core/create.java interrupts unexpectly #148

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Flex Builder 3 + Flash Player 9
2. pdf.addImage()...
3. create.java as Servlet /CreatePDF
4. pdf.sava(Method.REMOTE, "/CreatePDF", ...);
5. 

What is the expected output? What do you see instead?
Expected to be the image on the page, but get a message "There was an 
error opening this document. This file is damaged and could not be 
repaired." from Adobe Reader.

What version of the product are you using? On what operating system?
AlivePDF 0.1.4.9

Please provide any additional information below.
The bug is easy to fix, thanks to my fiend.
Change 
    while (true)
    {
        k = si.read(bytes,i,maxLength);
        i += k;
        if (k <= 0)
            break;
    }
to 
    while (true) {
        k = si.read(bytes, i, maxLength);
        i += k;
        if (i == maxLength)
            break;
    }

Original issue reported on code.google.com by EviS...@gmail.com on 5 Aug 2009 at 1:27

GoogleCodeExporter commented 9 years ago
Have to say Java's operating HTTP protocol is more low-level than PHP or CSharp.

Original comment by EviS...@gmail.com on 5 Aug 2009 at 1:30

GoogleCodeExporter commented 9 years ago
Sorry please igore this issue. I mad a mistake:

I modified
    if (k <= 0)
to 
    if (k >= 0)
when I added this servlet to my project.

But this < is really a "<", "k <= 0" produces the same result of "i == 
maxLength". My fault.

Original comment by EviS...@gmail.com on 5 Aug 2009 at 1:39