ENART.XN--W1YW3PUTK.COM
welcome to my space
X
Welcome to:enart.xn--w1yw3putk.com
 HOME   php reading and writing to binary files
php reading and writing to binary files
Published by: mike 2010-03-14
  • I want to read and write the xmp metadata packet inside an adobe pdf file. I can successfully read out the packets with a grep pattern, but writing it back is much more complex. I have an idea of how it is done, but I'm wondering if anybody has done this. How can I use php to write a new xmp metadata packet into an adobe pdf file without corrupting the file?


  • /* binary file read & write */ // for binary file read and write we have to use the mode 'b' b for binary //in php to open a binary file use $filename="xyz.pdf"; $fp=fopen($filename,"rb"); $contents=fread($fp,filesize($filename)); fclose($fp); /* in the contents u can modify what xmp u want */ again $filename="xyz.pdf"; $fp=fopen($filename,"wb"); if (fwrite($fp, $contents) === FALSE) { echo "Cannot write to file ($filename)"; exit; } fclose($fp); try with this method regards indianguysiva-ga


  • Purpose: Binary-safe file read Usage: string fread (int fp, int length) Availability: PHP 3, PHP 4 >= 4.0.0 fread() reads up to length bytes from the file pointer referenced by fp. Reading stops when length bytes have been read or EOF is reached, whichever comes first. // get contents of a file into a string $filename = "/usr/local/something.txt"; $fd = fopen ($filename, "r"); $contents = fread ($fd, filesize ($filename)); fclose ($fd);


  • This is specifically about writing an xmp metadata packet inside an adobe pdf file. It seems to involve udating the "dictionary" (?) or something and whatever other requirements to prevent the file from becoming corrupted.


  • int fwrite (int fp, string string [, int length]) fwrite() writes the contents of string to the file stream pointed to by fp. If the length argument is given, writing will stop after length bytes have been written or the end of string is reached, whichever comes first.





  • I could use some help again...
    Lost Licences
  • load a new image
  • form submission in php
  • holidays 2005
  • code for no toolbars
  • hello forum
  • table width problem in ie
  • a different tables iframes question
  • openpage 2006
  • list fascinating myths
  • revisions to guidlelines and faq
  • picture problem
  • converting ms front page
  • masking your url
  • jumping in head first
  •  
  • using your index html
  • please review this site
  • include vs frames
  • help with table alignment
  • javascript in css
  • onmouseover event
  • auto detecting flash
  • table help
  • flash movie clips
  • fireworks mx slices
  • i m wondering
  • css and 1st page
  • password scripts
  • if only i could add this
  • unlimited bandwidth in web hosting
  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about php reading and writing to binary files , Please add it free.
     Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 enart.xn--w1yw3putk.com        Site made:CFZ