D
Don
Hi, folks --
I've been tasked to write some simple JPEG/EMF export apps to interface
with an enterprise content management system. The ECM triggers one or more
of these little helpers when a content item of the corresponding type is
checked in, and the helper spits out a JPEG or EMF of the correct size, dpi,
compression, and so on, or it spits out an EMF.
Here's the code I'm currently using to drive Visio to spit out a JPEG:
Private Function ExportDrawing( _
byRef strDrawingName as String, _
byRef strExportFile as String _
) as Boolean
Dim objVisioApp As New Visio.InvisibleApp
Dim objVisioDoc As Visio.Document
Dim objVisioPage As Visio.Page
objVisioDoc = objVisioApp.Documents.Open( strDrawingName )
objVisioPage = objVisioDoc.Pages( 1 )
objVisioPage.CenterDrawing
objVisioPage.Export( strExportFile )
objVisioDoc.Saved = True ' avoid "exit without saving" dialog box.
objVisioApp.Quit
ExportDrawing = True
End function
(Actually, it'll spit out any format, as long as the destination file's
extension is supported.)
No-nonsense: no smart error-trapping yet, and it doesn't try to connect to
a running Visio session. But it works. Almost.
Before polishing it, I need to find a way to control the JPEG compression,
dpi, and so on. I haven't been able to find out how to do this via the Visio
API. This is surprising considering how much more control I had over this in
the other Office apps. Perhaps I'm just not looking in the right place.
Do you know how to control export image resolution in Visio? Or do you
know of a good "batch" Visio-to-JPEG converter app someplace?
I've been tasked to write some simple JPEG/EMF export apps to interface
with an enterprise content management system. The ECM triggers one or more
of these little helpers when a content item of the corresponding type is
checked in, and the helper spits out a JPEG or EMF of the correct size, dpi,
compression, and so on, or it spits out an EMF.
Here's the code I'm currently using to drive Visio to spit out a JPEG:
Private Function ExportDrawing( _
byRef strDrawingName as String, _
byRef strExportFile as String _
) as Boolean
Dim objVisioApp As New Visio.InvisibleApp
Dim objVisioDoc As Visio.Document
Dim objVisioPage As Visio.Page
objVisioDoc = objVisioApp.Documents.Open( strDrawingName )
objVisioPage = objVisioDoc.Pages( 1 )
objVisioPage.CenterDrawing
objVisioPage.Export( strExportFile )
objVisioDoc.Saved = True ' avoid "exit without saving" dialog box.
objVisioApp.Quit
ExportDrawing = True
End function
(Actually, it'll spit out any format, as long as the destination file's
extension is supported.)
No-nonsense: no smart error-trapping yet, and it doesn't try to connect to
a running Visio session. But it works. Almost.
Before polishing it, I need to find a way to control the JPEG compression,
dpi, and so on. I haven't been able to find out how to do this via the Visio
API. This is surprising considering how much more control I had over this in
the other Office apps. Perhaps I'm just not looking in the right place.
Do you know how to control export image resolution in Visio? Or do you
know of a good "batch" Visio-to-JPEG converter app someplace?