PDA

View Full Version : Need to print to a file



BobFromBoston
01-13-2006, 04:05 PM
Greetings,

I need to use PrintOut() to print the map to a file, but find that it's locking up when I make the call. Here are the parameters I'm using.


mpMap.PrintOut("c:\\tmp\\test.ptm","Test",1,
MapPoint.GeoPrintArea.geoPrintDirections,
MapPoint.GeoPrintQuality.geoPrintQualityPresentati on,
MapPoint.GeoPrintOrientation.geoPrintAuto,
false,false,false,false);

Can someone please point out what I'm doing wrong with this? I'm using C#, and I find the program hangs on that command, indefinitely. When I select "Break" from the "Debug" menu, it's as if the program is active at the cursor, but if I press F10, it hangs all over again.

Thanks for the help,
Bob

BobFromBoston
01-13-2006, 10:55 PM
I have moved my program to another computer, and the file is being written. (I realized the file format is tif.) So it works. But oddly, without my prompting, Microsoft Office Document Imaging viewer opens automatically, and displays the image.

Has anybody got any idea why it's opening? How about to block it from opening? And on my main development machine it still hangs when I call PriotOut(). Could it be hanging, perhaps, because there is no default viewer? And it works on my second machine because there is a default viewer?

I'd appreciate anybody's help.

Thanks.
Bob

Wilfried
01-14-2006, 06:54 AM
Hi,

I did exacly same test on my development machine, it does not block, the file is written to. Nothing is opened but I dont have that viewer installed.


mp.ActiveMap.PrintOut("c:\\test.ptm", "test", 1,
GeoPrintArea.geoPrintMap,
GeoPrintQuality.geoPrintQualityPresentation,
GeoPrintOrientation.geoPrintAuto,
false, false, false, false);

I have no idea wy it should block on your other machine. Did you tryed to print to a printer also to test ?

About the auto opning. I'm pretty sure you can set this in registry that it would not, or maybe do not use it as default opener.

As an alternative you can probably copy the map image to clipboard, then copy it into an image object and save to file.