Universal Document Converter
Información general
Descargas
Comprar
Tutoriales
Desarrolladores
Soporte técnico
Acerca de fCoder SIA


      Búsqueda en el sitio
   


      Conversiones populares
Adobe PDF a JPEG
Word Document a PDF
Hojas de cálculo Excel a PDF
PowerPoint a JPEG
Diseño Visio a PDF
Diseño AutoCAD a TIFF
Página web a JPEG
Convertir de cálculo Excel a PDF
Convertir DjVu a PDF
Convertir una página web a PDF

      Tutorial de vídeo
Ver el tutorial



Página principal>Developer Solutions>Examples>Visual Basic 6>Visio Diagrams to TIFF

Converting Visio Diagrams to TIFF


'----------------------------------------------------------------------
' 1) Microsoft Visio 2000 or above should be installed and activated on your PC.
'
' 2) Universal Document Converter 5.2 or above should be installed, too.
'
' 3) Open your project in Microsoft Visual Basic 6.0.
'
' 4) In Visual Basic main menu press "Project->References".
'
' 5) In the list of references check "Universal Document Converter Type Library".
'----------------------------------------------------------------------

Private Sub PrintVisioToTIFF(strFilePath As String)

' Define constants
  Const visOpenRW = &H20
  Const visOpenDontList = &H8
  Const visPrintAll = 0

  Dim objUDC As IUDC
  Dim itfPrinter As IUDCPrinter
  Dim itfProfile As IProfile
  
  Dim objVisioApp As Object
  Dim itfDrawing As Object
    
' Use Universal Document Converter API to change settings of converterd document
  Set objUDC = New UDC.APIWrapper
  Set itfPrinter = objUDC.Printers("Universal Document Converter")
  Set itfProfile = itfPrinter.Profile
  
  itfProfile.Load ("C:\Program Files\Universal Document Converter\UDC Profiles\Drawing to TIFF.xml")
  
  itfProfile.OutputLocation.Mode = LM_PREDEFINED
  itfProfile.OutputLocation.FolderPath = "C:\Out"
  
  itfProfile.PostProcessing.Mode = PP_OPEN_FOLDER

' Run Microsoft Visio as COM-server
  On Error Resume Next
    
  Set objVisioApp = CreateObject("Visio.Application")
  objVisioApp.Visible = False

' Open drawing from file
  Err = 0 ' Clear GetLastError() value
  Set itfDrawing = objVisioApp.Documents.OpenEx(strFilePath, visOpenRW And visOpenDontList)
  
  If Err = 0 Then
    
  ' Change Drawing preferences for scaling it to page
    itfDrawing.PrintCenteredH = True
    itfDrawing.PrintCenteredV = True
    itfDrawing.PrintFitOnPages = True
    
  ' Print drawing
    itfDrawing.Printer = "Universal Document Converter"
    itfDrawing.PrintOut (visPrintAll)

  ' Close drawing
    itfDrawing.Saved = True
    itfDrawing.Close
    Set itfDrawing = Nothing
    
  End If
    
' Close Microsoft Visio
  Call objVisioApp.Quit
  Set objVisioApp = Nothing

End Sub


© fCoder SIA Acerca de fCoder SIA | Mapa del sitio