Originally Posted by
whiteflags
If you did not build cairo I don't know how you managed to link your code. I can get cairo from here:
Download And since I am using a 32 bit compiler I read the page and landed on here:
GTK+ Download: Windows (32-bit) since it's one of the GTK+ dependencies. The thing is, what you get by downloading cairo from there is a DLL. You have to use the Win32 API to load and use a DLL in your code. So I'm going to ask exactly where did you get cairo from and what did you download?
Ok, everybody, I found out a solution to my problem. Now, I can write one line in pdf, I can write two lines in pdf, I can convert txt to pdf using C++ with DEV-C++ and code:blocks.
I was downloading the include and lib of cairo library correctly. My mistake was that I was downloading the dll files that can make other funcions, but could not create a pdf file correcty. I was getting these dll from the site Using Cairo With GDI and I was wrong. So, the correct dlls I need are placed at GTK+ Download: Windows (32-bit).
Now, this code and others can be executed with no problem.
Code:
#include <cairo.h>
#include <cairo-pdf.h>
int main(int argc, char **argv) {
float position;
cairo_surface_t *surface;
cairo_t *cr;
surface = cairo_pdf_surface_create("line.pdf", 504, 648);
cr = cairo_create(surface);
position=50.0;
cairo_move_to(cr, 8.0, position);
cairo_show_text(cr, "This is line 1");
cairo_show_page(cr);
cairo_surface_destroy(surface);
cairo_destroy(cr);
}
I would like to thank everybody here. You all helped to solve this problem.
THANK YOU VERY MUCH!!!