Hi guys i want create a program that can write to a pdf file and here is the code i used.
when i run the program, it compiles well, and runs but the pdf file that is created is not readable/corrupt. i am just wondering whether there is some library that am supposed to use ......... thanx


using namespace std;

int main(){

 ofstream myFile;

 myFile << "This is a sample for writing to a pdf file";


return 0;

The thing with PDFs are that aren't just strait up text files, I don't know how you would go about coding them and I can't imagine that it's easy so the standard I/O stream (istream, ostream, etc) aren't going to work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.