How to convert an hpgl to a bmp from a WPF application

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
Davidk
Posts: 3
Joined: 10 Jul 2009, 16:11

How to convert an hpgl to a bmp from a WPF application

Post by Davidk » 10 Jul 2009, 17:29

Hello,
I have a WPF application that reads a DXF, converts it to a bitmap and then warps the image shape to fit on a work surface. This is used with a projector and the user input is a barcode that indicates the file name. I have a customer who wants me to support HPGL.

What is the easiest way to convert an HPGL file into a BMP file with CADImport7 Pro? I do not want to visualize the HPGL. I will load the BMP into the WPF interface after conversion.

Best regards.

Davidk
Posts: 3
Joined: 10 Jul 2009, 16:11

Re: How to convert an hpgl to a bmp from a WPF application

Post by Davidk » 10 Jul 2009, 20:59

Hi,

I used the following method:

Dim cadImageFld As CADImage
Dim tmp As String = System.IO.Path.Combine(tmpDir, Now.Ticks & ".bmp")
cadImageFld = CADImage.CreateImageByExtension(imageFName)
cadImageFld.LoadFromFile(imageFName)
If (Not cadImageFld Is Nothing) Then
Dim tmpRect As New DRect(0, 0, 1280, 768)
Dim imgFrm As ImageFormat = ImageFormat.Bmp
cadImageFld.LineWeightScale = 0.0
cadImageFld.SaveToFile(tmp, imgFrm, tmpRect)
End If

Do you recommend any changes?

Best regards.

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: How to convert an hpgl to a bmp from a WPF application

Post by support » 14 Jul 2009, 11:13

Hello.
I can make only one remark. You can use CADImage.SaveToStream method instead the CADImage.SaveToFile and load from stream into your application without file creation.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply