2016-03-03 42 views

回答

0

AutoCAD的Publish to Web打印機是非常糟糕的。我要做的是使用DWG to PDF打印機或類似的打印機(autocad的默認打印機列表中有幾個),然後使用第二個軟件如Photoshop,GIMP等將該pdf轉換爲光柵圖像。甚至有一些小型軟件可將pdf轉換爲jpgs像TTRPDFToJPG3。如果您對您要查找的輸出類型有特定的想法,請隨時進一步闡述。乾杯!

0

如果你正在尋找一個綱領性的方式來捕捉畫面,那就是:

using acApp = Autodesk.AutoCAD.ApplicationServices; 
using Autodesk.AutoCAD.Runtime; 
using System.Drawing.Imaging; 
using System.Drawing; 

namespace ScreenshotTest 
{ 
    public class Commands 
    { 
    [CommandMethod("CSS")] 
    static public void CaptureScreenShot() 
    { 
     ScreenShotToFile(
     acApp.Application.MainWindow, 
     "c:\\main-window.png", 
     0, 0, 0, 0 
    ); 
     ScreenShotToFile(
     acApp.Application.DocumentManager.MdiActiveDocument.Window, 
     "c:\\doc-window.png", 
     30, 26, 10, 10 
    ); 
    } 

    private static void ScreenShotToFile(
     Autodesk.AutoCAD.Windows.Window wd, 
     string filename, 
     int top, int bottom, int left, int right 
    ) 
    { 
     Point pt = wd.Location; 
     Size sz = wd.Size; 

     pt.X += left; 
     pt.Y += top; 
     sz.Height -= top + bottom; 
     sz.Width -= left + right; 

     // Set the bitmap object to the size of the screen 

     Bitmap bmp = 
     new Bitmap(
      sz.Width, 
      sz.Height, 
      PixelFormat.Format32bppArgb 
     ); 
     using (bmp) 
     { 
     // Create a graphics object from the bitmap 

     using (Graphics gfx = Graphics.FromImage(bmp)) 
     { 
      // Take a screenshot of our window 

      gfx.CopyFromScreen(
      pt.X, pt.Y, 0,0, sz, 
      CopyPixelOperation.SourceCopy 
     ); 

      // Save the screenshot to the specified location 

      bmp.Save(filename, ImageFormat.Png); 
     } 
     } 
    } 
    } 
} 

來源:Taking screenshots of AutoCAD’s main and drawing windows using .NET

0

感謝大家。我使用GIMP將它們轉換爲PNG格式,然後以pdf格式保存文件。