I am develping a program to create an rtf file.The rtf file will be having images in it that will form a border around the page.
Here is the code so far:

#include "rtflib.h"
#include "globals.h"
#include "errors.h"



void main()

{	
	
	// Set RTF document font and color table
	char font_list[] = "Times New Roman;Arial;";
	char color_list[] = "0;0;0;255;0;0;192;192;192;255;255;255";
	
	// Open RTF file
	rtf_open( "Sample2.rtf", font_list, color_list );
	rtf_load_image("Picture.jpg", 50, 50);
	rtf_load_image("Picture.jpg", 50, 50);
	rtf_load_image("Picture.jpg", 50, 50);
	rtf_load_image("Picture.jpg", 50, 50);
	rtf_load_image("Picture.jpg", 50, 50);
	rtf_load_image("Picture.jpg", 50, 50);
	rtf_load_image("Picture.jpg", 50, 50);
	rtf_load_image("Picture.jpg", 50, 50);
	rtf_load_image("Picture.jpg", 50, 50);
	
		rtf_load_image("Picture.jpg", 50, 50);

		rtf_close();
}

However instead of forming a border, the images are at the center of the page one after the other.
Is there any way by which i can make them form a border? something like allignment?

Carry on reading the documentation for rtflib perhaps?

Or create an RTF file how you want, then write a program to "dump" the RTF file so you know what the structure is, then repeat that in your program.

Carry on reading the documentation for rtflib perhaps?

Or create an RTF file how you want, then write a program to "dump" the RTF file so you know what the structure is, then repeat that in your program.

I wish that would have been easy, but it isn't. the only way i can think of creating an rtf file like that is by using ms word. but it adds thousands of lines of hectic codes to the simple rtf file making it almost impossible to understand.
Moreover, I do not know how to do the "dump" procedure you talked about and i doubt if it would be helpful as the program is not intended to take a particular image file but different file every time.Any ideas then?

Well how did you get that far without RTFM?

> Moreover, I do not know how to do the "dump" procedure you talked about
It's pretty much the first step. Given a file format and an API, use it to read a few files, and print information about that file. It gives you practical experience of how real files are structured, which reading manuals seldom can.

sorry, i should have told that I am still a beginner in this. :?:

Yes, this will take a while. Learning how to best use a new API does.

But FWIW, I think you've made a good start, you just need to stick at it.

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.