Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Macintosh PDF's on Windows

by almut (Canon)
on Mar 01, 2007 at 18:28 UTC ( #602742=note: print w/replies, xml ) Need Help??

in reply to Macintosh PDF's on Windows

Yes, you sure don't want to change the 0D into anything else... Apart from the xref table, there are typically also zipped (i.e. binary) streams, which also could contain 0D bytes.

As long as you open input and output filehandles without automatic line ending translation, you should be fine, though. And, if you need to process the file in a line-based fashion, just set the input record separator $/ to "\r" (=0D):

$/ = "\r"; open my $in_fh, "<:raw", "Mac_in.pdf" or die "$!"; open my $out_fh, ">:raw", "Mac_out.pdf" or die "$!"; while (<$in_fh>) { # do something with the line... print $out_fh $_; }

(also make sure to never change the size (number of bytes) of any objects in the PDF, or else the offsets given in the xref table will become incorrect... but you probably knew that already)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://602742]
and nobody stirs...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2017-03-26 07:32 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (313 votes). Check out past polls.