chengse66 / alivepdf

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

AddImage, AddImageStream does not produce image in result #230

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. imageSnap = ImageSnapshot.captureImage(printButton, 120, jpgEncoder)
2. p.addImageStream(imageSnap , ColorSpace.DEVICE_RGB, new Resize (
Mode.RESIZE_PAGE, Position.CENTERED ) );
3. d.save(....);

What is the expected output? What do you see instead?
Expected output is complete PDF file with proper placement of image stream
in the body. Instead I have just several symbols in the output and PDF
document is corrupted and stream block never gets closed.

What version of the product are you using? On what operating system?
Version 1.5, Windows XP

Please provide any additional information below.
The problem exactly in the following lines of code:
stream = image.bytes;
write('/Length '+stream.length+'>>');
write('stream');
buffer.writeBytes(stream);
buffer.writeUTFBytes ("\n");
write("endstream");
write('endobj');

It never writes 'endstream', 'endobj', cause of some of the problems in
buffer.writeBytes method.

If I do base64 conversion of byte array that represents image and send it
to PHP script and decode it in there - I get correct image I'm expecting to
be imported into PDF file.

The same happens when I simply pass display object in the addImage method.

Really hope for your help.

Original issue reported on code.google.com by stanly.t...@gmail.com on 21 Apr 2010 at 1:11

GoogleCodeExporter commented 8 years ago
I found the problem seems to be in the symbol with zero code. It just does not 
get it
right and stops outputting when meets it. 
I'm pretty sure it works for AIR, but it does not work for the case when you 
send PDF
to PHP script.

Original comment by stanly.t...@gmail.com on 23 Apr 2010 at 2:57