Universal Document Converter
Informazioni sul prodotto
Scarica
Acquista
Tutorial
Soluzioni per sviluppatori
Servizio di assistenza
Chi è fCoder SIA


      Cerca nel sito
   


      Conversioni più richieste
Da Adobe PDF a JPEG
Da documento Word a PDF
Da foglio di lavoro Excel a PDF
Da PowerPoint a JPEG
Da disegno Visio a PDF
Da disegno AutoCAD a TIFF
Da pagina Web a JPEG
Convertire di lavoro Excel in PDF
Convertire da DjVu in PDF
Pagine Web in PDF



Pagina principale>Developer Solutions>Examples>Visual Basic.NET>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.NET.
'
' 4) In Visual Basic main menu press "Project->Add Reference...".
'
' 5) In "Add Reference" window go to "COM" tab and double click into 
'    "Universal Document Converter Type Library".
'----------------------------------------------------------------------

Private Sub PrintVisioToTIFF(ByVal strFilePath As String)

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

    Dim objUDC As UDC.IUDC
    Dim itfPrinter As UDC.IUDCPrinter
    Dim itfProfile As UDC.IProfile

    Dim objVisioApp As Object
    Dim itfDrawing As Object

    ' Use Universal Document Converter API to change settings of converterd document
    objUDC = New UDC.APIWrapper
    itfPrinter = objUDC.Printers("Universal Document Converter")
    itfProfile = itfPrinter.Profile

    itfProfile.Load("C:\Program Files\Universal Document Converter\UDC Profiles\Drawing to TIFF.xml")

    itfProfile.OutputLocation.Mode = UDC.LocationModeID.LM_PREDEFINED
    itfProfile.OutputLocation.FolderPath = "C:\Out"

    itfProfile.PostProcessing.Mode = UDC.PostProcessingModeID.PP_OPEN_FOLDER

    ' Run Microsoft Visio as COM-server
    On Error Resume Next

    objVisioApp = CreateObject("Visio.Application")
    objVisioApp.Visible = False

    ' Open drawing from file
    itfDrawing = objVisioApp.Documents.OpenEx(strFilePath, visOpenRW And visOpenDontList)

    ' 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()
    itfDrawing = Nothing

    ' Close Microsoft Visio
    Call objVisioApp.Quit()
    objVisioApp = Nothing

End Sub


© fCoder SIA Chi è fCoder SIA | Mappa del sito