ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / JPEGFormat Class / HasWorldFile Property
Example

In This Topic
    HasWorldFile Property (JPEGFormat)
    In This Topic
    Gets or sets if a georeferenced world file will be created.
    Syntax
    public bool HasWorldFile {get; set;}
    Public Property HasWorldFile As Boolean
    Remarks

    If set to true, the file will contain pixel scale and real-world coordinate information. World files are not generated for Layout exports.

    If you export a 3D view, this parameter will be ignored regardless of the setting because world files are not applicable to 3D views.

    The default value is false.

    Example
    Export a map frame to JPG
    {
      //Export a map frame to JPG.
      string filePath = @"Path and file name for the output export file";
      //Create JPEG format with appropriate settings
      //BMP, EMF, EPS, GIF, PDF, PNG, SVG, TGA, and TFF formats are also available for export
      JPEGFormat JPG = new JPEGFormat()
      {
        HasWorldFile = true,
        Resolution = 300,
        OutputFileName = filePath,
        ColorMode = JPEGColorMode.TwentyFourBitTrueColor,
        Height = 800,
        Width = 1200
      };
    
      //Export on the worker thread
      await QueuedTask.Run(() =>
      {
        //Reference the map frame
        MapFrame mf = layout.FindElement("MyMapFrame") as MapFrame;
    
        //Check to see if the path is valid and export
        if (JPG.ValidateOutputFilePath())
        {
          mf.Export(JPG);  //Export the map frame to JPG
        }
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also