hansixxxxx

Newbie needs help with pdf export

Discussion created by hansixxxxx on Jul 15, 2010
Latest reply on Jul 16, 2010 by hansixxxxx
Hi,

i am trainee who has the challange to work with ESRI (not easy :mad:)

At first I have an GUI with an axMapControl.
Now I want to save the active view of the map to an pdf file.

But my export doesnt work with SipleMarker (these objects are not shown on the exportet picture/file)

What can i do to export the SimpleMarker-Objects too??



My Simple marker with are drawing on the map (I also have some single Points)
        private void drawGraphicLineOnMap(List<IPoint> points, IColor color, esriSimpleLineStyle style)
        {
            Polyline lines = new PolylineClass();
            System.Object missing = Type.Missing;

            foreach (IPoint point in points)
            {
                lines.AddPoint(point, ref missing, ref missing);
            }

            ISimpleLineSymbol lineSymbol = new SimpleLineSymbolClass();
            lineSymbol.Style = style;
            lineSymbol.Color = color;
            lineSymbol.Width = 1;

            System.Object objectMarker = (object)lineSymbol;

            this.m_mapControl.DrawShape((IGeometry)lines, ref objectMarker);
        }


here is my pdf export.
    private void saveAsPDF() 
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.Filter = "Textdatei (*.pdf)|*.pdf";
            saveFileDialog.Title = "Export active view to PDF";
            saveFileDialog.RestoreDirectory = true;
            saveFileDialog.FileName = System.IO.Path.Combine(saveFileDialog.InitialDirectory, "filename" + DateTime.Now.ToString("(dd-MM-yyyy_HH-mm-ss)"));

            if (saveFileDialog.ShowDialog().Equals(DialogResult.OK))
            {
                //GeoPDF Konvertierung
                IEnvelope pEnvelope;
                pEnvelope = (IEnvelope)axMapControl1.ActiveView.Extent.Envelope;
                IExport pExport;
                pExport = new ExportPDFClass();
                
                // Windows Auflösung ist 96, wir wollen aber in 300 exportieren 
                // Deswegen wird die Grö??e hier neu berechnet 
                System.Int32 screenResolution = 96;
                System.Int32 outputResolution = 300;
                pExport.Resolution = outputResolution;
                ESRI.ArcGIS.Display.tagRECT rectangle;
                rectangle.left = 0;
                rectangle.top = 0;
                rectangle.right = axMapControl1.ActiveView.ExportFrame.right * (outputResolution / screenResolution);
                rectangle.bottom = axMapControl1.ActiveView.ExportFrame.bottom * (outputResolution / screenResolution);
                EnvelopeClass pDriverBounds = new EnvelopeClass();
                pDriverBounds.PutCoords((double)rectangle.left, (double)rectangle.bottom, (double)rectangle.right, (double)rectangle.top);
                pExport.PixelBounds = pDriverBounds;
                pExport.ExportFileName = @saveFileDialog.FileName;

                //Exportieren
                int hDC = pExport.StartExporting();
                
                axMapControl1.ActiveView.Output(hDC, (int)outputResolution, ref rectangle, null, null);
                pExport.FinishExporting();
                pExport.Cleanup();
            }



I hope somebody can help me.

Outcomes