On Wed, Nov 07, 2007 at 03:41:02PM +0700, Olivier Nicole wrote:
> I am playing around with a PDF plugin, I'd like to process the images
> extracted from a pdf document through an OCR plugin.

Hrm.  FYI, there are assumptions made that the internal message structure is
from the original message.  So while I don't think things will break, some
rules may trigger inappropriately if you "blow their mind".

>     # Perpare the contents of the part
>     $part_array->[0]="--$boundary";
>     $part_array->[1]="Content-Type: image/tiff;";
>     $part_array->[2]="Content-Transfer-Encoding: Base64";
>     $part_array->[3]="";

Part data doesn't have mime boundaries and headers.  It's just the part
content.  You would want to parse/shove this data into the object header.

>     open(FILE, "$dir/$tifffile") or die "$!";
>     while (read(FILE, $buf, 60*57)) {
>       $part_array->[$pline++]=MIME::Base64::encode_base64($buf);
>     }

Don't you have this from the message tree already?

>     $part_msg->header("content_type", "image/tiff");

I think you'd want "content-type".

>     push(@{$msg->{'parse_queue'}}, [ $part_msg, $boundary, $part_array, 1 ]);
>     $msg->add_body_part($part_msg);

This doesn't make sense.  You either want to add the body part to the correct
part of the tree, or setup the parse queue appropriately and let it do it.

> How to get the typ eto be kept in the added part?

see above, you need to set the header correctly.

-- 
Randomly Selected Tagline:
Buffer: A nude hacker.

Attachment: pgpc34jvLu3HO.pgp
Description: PGP signature

Reply via email to