jessieleo

GeoTiff =True not working in Arcobjects of VBA

Discussion created by jessieleo on May 6, 2010
Hi,

I am using IExportTIFF to export maps to TIFF format with GeoTiff, while it is not coordinate related. the following is my code.
Is thers something wrong for my code.

Thank you for your help.


Private Sub CreateTIFF(pPageLayout As esriCarto.IPageLayout, sFullPathName As String)
 
  Dim pExporter As esriOutput.IExport
    Dim pExportTIFF As IExportTIFF
  Dim pTiffExporter As ITiffExporter
 
 
  Dim pExportVectorOptions As esriOutput.IExportVectorOptions
  Dim pExportColorspaceSettings As esriOutput.IExportColorspaceSettings
  Dim pOutputRasterSettings As esriDisplay.IOutputRasterSettings
  Dim pAV As esriCarto.IActiveView
   
  Dim pPixelEnv As esriGeometry.IEnvelope
  Dim tExpRect As esriDisplay.tagRECT
  Dim hdc As OLE_HANDLE
    
  Dim pDriverBounds As esriGeometry.IEnvelope
  Dim pVisibleBounds As esriGeometry.IEnvelope
  Dim pPixelBounds As esriGeometry.IEnvelope
  Dim ipPixelBounds As esriGeometry.IEnvelope
 

  Set pActiveView = pmxdoc.FocusMap
  Set pVisibleBounds = New esriGeometry.Envelope
  Set pVisibleBounds = Nothing
 
  Set pPixelBounds = New esriGeometry.Envelope
 

  Set pExportTIFF = New esriOutput.ExportTIFF
 

  Set pExporter = pExportTIFF
 

 
  If CheckBox_GeotiffTag.Value = True Then
        pExportTIFF.GeoTiff = True
  ElseIf CheckBox_GeotiffTag.Value = False Then
        pExportTIFF.GeoTiff = False
  End If


  Select Case pImageCompression
 
        Case "None"
             pExportTIFF.CompressionType = esriTIFFCompressionNone
        Case "JPEG"
            pExportTIFF.CompressionType = esriTIFFCompressionJPEG
        Case "LZW"
             pExportTIFF.CompressionType = esriTIFFCompressionLZW
        Case "Deflate"
             pExportTIFF.CompressionType = esriTIFFCompressionDeflate
        Case "Pack Bits"
            pExportTIFF.CompressionType = esriTIFFCompressionPackBits
           
  End Select
    
   
  
  Set pPixelEnv = New esriGeometry.Envelope
  pPixelEnv.PutCoords _
    0, _
    0, _
    lngOutputResolution * PageExtent(pPageLayout).UpperRight.x, _
    lngOutputResolution * PageExtent(pPageLayout).UpperRight.y
 
  With pExporter
    .PixelBounds = pPixelEnv
    .Resolution = lngOutputResolution
    .ExportFileName = sFullPathName
  End With

' device coordinates origin is upper left, y positive is down
With tExpRect
    .Left = pExporter.PixelBounds.LowerLeft.x
    .bottom = pExporter.PixelBounds.UpperRight.y
    .Right = pExporter.PixelBounds.UpperRight.x
    .Top = pExporter.PixelBounds.LowerLeft.y
  End With


' export
  hdc = pExporter.StartExporting
    Set pAV = pPageLayout
    pActiveView.Output hdc, lngOutputResolution, tExpRect, Nothing, Nothing
    DoEvents
    pExporter.FinishExporting


End Sub

Outcomes