ConvertCADToJPEG

Discuss and ask questions about CADViewX (Lite and Pro versions).

Moderators: SDS, support, admin

Post Reply
xerp
Posts: 8
Joined: 19 Jul 2006, 04:39
Location: China
Contact:

ConvertCADToJPEG

Post by xerp » 20 Jul 2006, 05:08

There is a function ConvertCADToJPEG(const ASrc, ADest: WideString; AMaxDimansions: Integer): WordBool;

How to define the parameter AMaxDimansions? could you give me a small sample code?

Thank you in advance.

Love all, trust a few, do wrong to none.

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

Post by support » 20 Jul 2006, 17:25

Use the following procedure:

Code: Select all

<b>procedure</b> TfmMain.ShowPreview;
<b>var</b>
  vSrc, vDst: WideString;
  vPreviewImage: TImage;
<b>begin
  if</b> OpenDialog1.Execute <b>then
  begin</b>
    vSrc := OpenDialog1.FileName;
    // convert to temporary file
    vDst := ExtractFilePath(Application.ExeName) + 'temp.jpg';
    <b>if</b> FCADViewX.ConvertCADToJPEG(vSrc, vDst, 600) <b>then
    begin</b>
      vPreviewImage := TImage(FindComponent('imPreviewImage'));
      <b>if</b> vPreviewImage = <b>nil then
      begin</b>
        vPreviewImage := TImage.Create(Self);
        vPreviewImage.Width := 800;
        vPreviewImage.Height := 600; // min dimension of vPreviewImage
        vPreviewImage.Name := 'imPreviewImage';
        vPreviewImage.Center := True;
        vPreviewImage.DragKind := dkDock;
        vPreviewImage.DragMode := dmAutomatic;
        vPreviewImage.ManualDock(<b>nil</b>);
     <b>end</b>;
      vPreviewImage.Hide;
      vPreviewImage.Show;
      vPreviewImage.Picture.LoadFromFile(vDst);
    <b>end</b>;
  <b>end</b>;
<b>end</b>;
//-----------------------------------------------------------------------
The method ConvertCADToJPEG doesn't always work correctly. This problem will be solved in the next release.


please post questions to the forum or write to support@cadsofttools.com

xerp
Posts: 8
Joined: 19 Jul 2006, 04:39
Location: China
Contact:

Post by xerp » 21 Jul 2006, 04:52

Thank you!

Love all, trust a few, do wrong to none.

Post Reply