bigr1822 Posted April 2, 2019 Posted April 2, 2019 All, I have created an application that will do some varies tasks. One of which it will send prints to a printer, or create PDFs. Here is why my struggles are. Is there a way to show a preview of the drawing file. I don't have an exact way that it needs to be done, just need to show a preview of the drawing. Any starter code would be nice. I've searched around trying to find some examples for PlotFactory.CreatePreviewEngine, without any luck. Thanks in advance for all your help. Rod Quote
KarlG Posted July 22, 2019 Posted July 22, 2019 Rod, Did you want to use the preview image from the drawing, as used in Explorer? if so then something like this might do the trick, the ides behind each file type are the same so every CAD file these days has an embedded bitmap that explorer can view. Public Sub PreviewBitmap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PreviewBitmap.Click DrawBitmapPreview(aFile) End Sub Private Sub DrawBitmapPreview(ByVal file As IEdmFile5) Try Dim varEnum As IEdmEnumeratorVariable5 varEnum = file.GetEnumeratorVariable Dim preview As IEdmBitmap5 preview = varEnum.GetThumbnail If preview Is Nothing Then Exit Sub preview.Draw(Me.Handle.ToInt32(), 45, 220, 0, 0) Catch ex As System.Runtime.InteropServices.COMException MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message) Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub copied from : http://help.solidworks.com/2017/english/api/epdmapi/get_bitmap_preview_of_file_example_vbnet.htm Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.