in reply to Object Label Badly Formatted
You are telling perl to read your pdf line by line, and then putting the line into a variable. With binary data, a byte sequence that looks like a line ending (0A on unix, 0D0A on Windows) could appear anywhere in your file. What you end up with is binary data that is, for lack of a better term, mangled.
You can get around the problem by doing this
Now, instead of reading to a newline, which is probably a random byte somewhere inside the pdf, you are reading in 32k bytes at a time. Your pdf stays in tact, and you shouldn't have any trouble.my $readbuf; while ( read (INF, $readbuf, 32767) # read in (up to) 32k chunks ) {$pdf .= $readbuf}
HTH, digger
|
|---|