2016-03-03 61 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格式保存文件。