Print directly to PDF from MapBasic

With the new MapInfo PDF Printer introduced in Mapinfo Professional 10.0 it is possible to print directly to a PDF file using the PrintWin statement.

The lines of code you need are:

mbpdffile

Set Window FrontWindow()  Printer Name “MapInfo PDF Printer Version 10.0″
PrintWin Window FrontWindow() File “C:\Temp\Test.pdf”

… and a new PDF file is created right away.

To overwrite an existing PDF file you should add the keyword Overwrite, i.e.:

PrintWin Window FrontWindow() File “C:\Temp\Test.pdf” Overwrite

Printing a Layout with Map, Browser etc. results in a PDF with layered Map part.

4 Responses to “Print directly to PDF from MapBasic”


  • that works fine but the pdf’s are hge how do you reduce the size for emailing non layered pdf with lower res need to reduce from 80 meg to 3 meg

  • You can limit the amount of data in the PDF and thus the file size by:

    - Set Map Window viewport to minimal extents around area of interest, all objects in visible viewport will be included in the PDF so make sure you set the Map Window to what you need in the PDF file.

    - Toggle Visibility off for layers that you do not need in the PDF

    - Toggle Selectable of for attributes of layers that you do not need in the PDF

    You can also check the PDF Printer properties and change options like Resolution and Image Compression in order to create smaller PDF files.

    In general the PDF file will not be bigger than the source data included.

    Regards,

    Emil Zegers

  • Attractive section of content. I just stumbled upon your website and in accession capital to assert that I get actually enjoyed account your blog posts. Any way I will be subscribing to your augment and even I achievement you access consistently fast.

  • It’s going to be ending of mine day, except before ending I am reading this wonderful paragraph to increase my experience.

Leave a Reply