I need to edit the header information of several PDF files.
What I'd like to achieve is to remove all header data before %PDF-X.Y.Z
.
What I came up with as a possible solution was to open the PDF in binary mode, read each character until %PDF-X.Y.Z
is found.
Then continue reading the rest of the stream and save it to a new file. I thought this way I will end up with an exact binary copy of the PDF, just with different header information.
What's the easiest/best way to do this in C? Are there any libraries available that could help me do this? I'm also interested in hearing different approaches to solve this problem.
Thanks.