Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am writting a code in plain C on AIX.
I want to read PDF file and store data in buffer.
and from that buffer i need to write it into another PDF file.
Is there any function for PDF files.
I used fputs(buffer,fileptr);
But it is writting data in different format.

How to read data from PDF and write it into another PDF file.

Please help me out.
Thanks in advance.
Posted

Poonamol wrote:
But it is writting data in different format.


No, it's not. The data is written exactly as it's provided. If your file is no longer a valid PDF, then your code is broken. If you're just making a copy, do you have access to any sort of platform specific libraries above standard C that might offer a file copy routine ?
 
Share this answer
 
Thanks for reply.

I want to copy that PDF document from DB server and store it on to AIX server.
 
Share this answer
 
PDF files are structured in a proprietary format (you can get the specification from the Adobe website) and are not simple text files. To copy such a file from one location to another you should use fread()and fwrite().
 
Share this answer
 
When storing binary data (PDF documents may contain binary data) you must not use fputs. Open the file in binary mode (i.e. use, for instance "wb") and write the buffer using fwrite [^].
:)
 
Share this answer
 
Thanks for the reply.

I am using IBM defined C API to get the contents from document to buffer.
I am using
virtual DKstring getContent () const; function.

So I am not able to get the correct contents from document.

Functions of DKBlobOD class,
getContent
Gets the content of this object.
virtual DKString getContent () const;

setContent
Sets the content of this object with a byte array stream argument.
virtual dkXDO& setContent (const DKString& data);

getContentToClientFile
Copies the large object (lob) data of this object to the given file.
virtual dkBlob& getContentToClientFile (const char* fName, int fOpt) const;

setContentFromClientFile
Replaces the lob data of this object with the contents of the file name.
virtual dkBlob& setContentFromClientFile (const char* fName);
 
Share this answer
 
Its working fine using fwrite.
:-O

Thanks a lot for reply.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900