Hi.
After using Aspose.CAD, I want to buy.
I downloaded Aspose.CAD and converted dwg file to image.
The image file is converted as shown below.
conic_pyramid_raster_image_out.png (22.5 KB)
What is solution?
The source is shown below.
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog(); // 파일 탐색기 창 객체 생성
// 파일 탐색기 Open
if (ofd.ShowDialog() == DialogResult.OK)
{
// The path to the documents directory.
// string MyDir = RunExamples.GetDataDir_ConvertingCAD();
// string sourceFilePath = MyDir + "conic_pyramid.dxf";
string MyDir = @"D:\dwg파일\toImage\";
string sourceFilePath = ofd.FileName;
using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
{
// Create an instance of CadRasterizationOptions
Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
// Set page width & height
rasterizationOptions.PageWidth = 1200;
rasterizationOptions.PageHeight = 1200;
rasterizationOptions.AutomaticLayoutsScaling = true;
rasterizationOptions.NoScaling = false;
// color
rasterizationOptions.BackgroundColor = Aspose.CAD.Color.Beige;
rasterizationOptions.DrawType = Aspose.CAD.FileFormats.Cad.CadDrawTypeMode.UseDrawColor;
rasterizationOptions.DrawColor = Aspose.CAD.Color.Blue;
// Aspose.CAD.CharacterSet.Hangeul
// Create an instance of PngOptions for the resultant image
Aspose.CAD.ImageOptionsBase options = new Aspose.CAD.ImageOptions.PngOptions();
// Set rasterization options
options.VectorRasterizationOptions = rasterizationOptions;
MyDir = MyDir + "conic_pyramid_raster_image_out.png";
// Save resultant image
image.Save(MyDir, options);
}
}
}
Thank you.
@softzion,
Can you please share source file so that we may further investigate to help you out.
Hi.
The source is shown below.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace DwgImageConverter
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog(); // 파일 탐색기 창 객체 생성
// 파일 탐색기 Open
if (ofd.ShowDialog() == DialogResult.OK)
{
// The path to the documents directory.
// string MyDir = RunExamples.GetDataDir_ConvertingCAD();
// string sourceFilePath = MyDir + "conic_pyramid.dxf";
string MyDir = @"D:\02. 소프트자이온\20. 한국미스미\dwg 변환관련\현업이준dwg압축파일\toImage\";
string sourceFilePath = ofd.FileName;
using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
{
// Create an instance of CadRasterizationOptions
Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
// Set page width & height
rasterizationOptions.PageWidth = 3000;
rasterizationOptions.PageHeight = 3000;
rasterizationOptions.AutomaticLayoutsScaling = true;
rasterizationOptions.NoScaling = false;
// color
rasterizationOptions.BackgroundColor = Aspose.CAD.Color.Beige;
rasterizationOptions.DrawType = Aspose.CAD.FileFormats.Cad.CadDrawTypeMode.UseDrawColor;
rasterizationOptions.DrawColor = Aspose.CAD.Color.Blue;
// Aspose.CAD.CharacterSet.Hangeul
// Create an instance of PngOptions for the resultant image
Aspose.CAD.ImageOptionsBase options = new Aspose.CAD.ImageOptions.PngOptions();
// Set rasterization options
options.VectorRasterizationOptions = rasterizationOptions;
MyDir = MyDir + "conic_pyramid_raster_image_out.png";
// Save resultant image
image.Save(MyDir, options);
}
}
}
}
}
Thank you.
@softzion,
Can you please share source file that you are using on your end so that i may test that with code and help you out.
Hi.
Look at the attachment.AsposeProject.zip (9.6 MB)
There is also a dwg file in the AsposeProject\AsposeProject\bin\Debug folder.
Thank you.
@softzion,
I have worked with the file shared by you and have been able to observe the issue specified. An issue with ID CADNET-779 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.
The issues you have found earlier (filed as CADJAVA-467) have been fixed in this update.
@softzion,
We have tried other options to make text better (rasterizationOptions.Quality.Text, rasterizationOptions.Quality.TextThicknessNormalization) but no success. The only way to improve it is to increase canvas size. In the attached project it is
rasterizationOptions.PageWidth = image.Width + 2000;
rasterizationOptions.PageHeight = image.Height + 2000;
and setting bigger values
rasterizationOptions.PageWidth = image.Width + 3000;
rasterizationOptions.PageHeight = image.Height + 3000;
makes text readable.
The issues you have found earlier (filed as CADNET-779) have been fixed in this update.