Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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)


Comment on Re: Macintosh PDF's on Windows
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://602742]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2014-07-30 01:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls