Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am following a printing tutorial, but it's not working.

The tutorial is here: http://edndoc.esri.com/arcobjects/9.2/NET/ViewCodePages/025b5da7-9b10-4623-a51e-c038c348ce29.PrintActiveViewCS_NetPrintActiveViewCS_Net.cs.htm

Maybe printing in ArcEngine 10 is different. The initial problem is that the PageLayout is null.

//I tried this like in the sample
docPaper.Orientation = m_hookHelper.PageLayout.Page.Orientation;

//Then I tried passing in my own ActiveView obj and casting to PageLayout
 IPageLayout pageLayout = docActiveView as IPageLayout;

But in both cases they are null.

Does anyone have a good link for printing in ArcEngine 10?

share|improve this question
    
Are you using the pagelayout control? –  Kirk Kuykendall Apr 15 '11 at 16:36
    
@Kirk Kuykendall No, I don't know anything about that. I tried adding esriControlCommands.ControlsPageLayoutToolbar to my toolbar but it was inactive. So I'm not really clear on what it's supposed to do, any links are appreciated. –  patrick Apr 15 '11 at 20:42
1  
If you want to print a nice looking map, I'd recommend using the pagelayoutcontrol instead of the mapcontrol. help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/… –  Kirk Kuykendall Apr 15 '11 at 20:47
add comment

1 Answer

The ActiveView can be either a Map or a Pagelayout if you check the sample you see that they are checking if the ActiveView is a pagelayout or not at several places. The reason for this is to make it would work in both cases. If you customizing the code and are only interested in printing a MapControl, you should look only on the parts of the code where the ActiveView is not a pagelayout.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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