0

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?

3
  • Are you using the pagelayout control? Commented Apr 15, 2011 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
    Commented Apr 15, 2011 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/… Commented Apr 15, 2011 at 20:47

1 Answer 1

1

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.

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.