I want to get each page of the document as an image (bmp, etc.), how do I do that?
If there is no direct way, is there any way to get the document in PDF format? If there is, i can convert it to an image and use it.
You can export the document tom many formats like jpeg, png or pdf etc. Check the following links
I see that you have tagged the post as SDK, so if you want to do this via scripting then you can use exportFile method
If you are looking at C++ sdk then look at kJPEGExportProviderBoss class, you can also look at SnapshotUtilsEx, an example of it can be seen in the SnippetRunner sample plugin
What do you mean as image?
What is the purpose for these images?
If you want to place these images into an InDesign file, use PDF/X-4. Export the INDD file as PDF/X-4 as single pages. Yo can place them as images into an InDesign file and you get better quality as with any other file type and flair.
If you need rasterized images, export PDF/X-4, open that in Photoshop as one image per page (it is a possible selction) and save them as JPG; TIFF or what else you want.
As Mani said, you can export to both JPG and PNG. No script needed unless you want to do something more complex than one image per page:
This produces one image file per page. The folder is recommended so you don't have to pick 10-100 or however many files from among others as the next step. You may want to select the base export file name carefully so that it's easy to manage as FILENAME-100.jpg etc.