I need to automatically print individual polygons that make up a table. I need them to be a close-up view of the polygon and print to a PDF file. It is very time consuming to print each one manually. I am thinking I will have to write a program to accomplish this, unless there is a tool that currently exists. Any ideas? The currrent process is to zoom in on the desired region until it fills the layout window. I then print the layout to a PDF, select the next region, and repeat.

  • 1
    this example shows you what you would need to do mapbasic-wise to select each feature and move the map to the location to print directly from the map window: spatialnews.geocomm.com/community/lists/… for your example you need to add a step to switch to the layout view between selection and print, and then to switch back to the map window to select and move to the next feature (to then repeat). You would need to consider how to name each output file to ensure that they are unique (either using a variable from the selection or a pdfwriter like PDFCreator)
    – Mark
    Commented Sep 4, 2013 at 9:06
  • Is there a way to control the MapInfo print dialog box? I would like the print to occur automatically without clicking on the OK button every time.
    – user15642
    Commented Sep 5, 2013 at 13:16
  • 1
    PrintWin in MapBasic has an optional Interactive keyword (if included int he statement the print dialog shows, if omitted the window should print automatically. Also an option here is the ability to use window_id which should help with printing the layout window. An example in the help file is PrintWin Window FrontWindow( ) File "c:\output\file.plt". Check out the MapBasic Help system for PrintWin Statement
    – Mark
    Commented Sep 5, 2013 at 13:58

1 Answer 1


You could use the code used in this example, but edit it to include syntax from PrintWin.

Having checked MapBasic help on my install, the help for PrintWin says:

PrintWin statement
Prints an existing window.

PrintWin [ Window window_id ][ Interactive ][ Fileoutput_filename ] [ Overwrite ]

window_id is a window identifier.

output_filename is a string representing the name of an output file. If the output file already exists, an error will occur, unless the Overwrite keyword is specified.

The PrintWin statement prints a window.

If the statement includes the optional Window clause, MapBasic prints the specified window; otherwise, MapBasic prints the active window.

The window_id parameter represents a window identifier; see the FrontWindow( ) function and the WindowInfo( ) function for more information about obtaining window identifiers.

If you include the Interactive keyword, MapInfo Professional displays the Print dialog box. If you omit the Interactive keyword, MapInfo Professional prints the window automatically, without displaying the dialog box.

Example 1

Dim win_id As Integer Open Table "world"
Map From world win_id => FrontWindow( )

' ' knowing the ID of the Map window,
' the program could now print the map by
' issuing the statement:

PrintWin Window win_id Interactive

Example 2

PrintWin Window FrontWindow( ) File "c:\output\file.plt"

So, with some tweaking and combining the 2 (and may be a sense check using this link, it should be possible to get a mapbasic driven process to step through your data and output a pdf file for each feature in the data.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.