We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert dwg and dxf file to pdf problem

Hi

1. I am try to convert Auto Cad files like dwg and dxf file to pdf conversion using following code and here i attach file also pls check and reply back.I cant convert attached files .it show "Image loading failed " error msg in first line.

Using image As Aspose.Imaging.Image = Aspose.Imaging.Image.Load(inputfile)
Dim pdfOptions As New PdfOptions()
pdfOptions.PageHeight = 1600
pdfOptions.PageWidth = 1600
’ pdfOptions.DrawType = CadDrawTypeMode.UseDrawColor
’ pdfOptions.DrawColor = Aspose.Imaging.Color.Red
pdfOptions.ScaleMethod = ScaleType.GrowToFit
image.Save(outputfile, pdfOptions)
End Using

2. I am try to convert all images files to pdf

ccitt,gif,jpeg,jpg,png,tif,tiff,bmp,emf,exif,icon,wmf to pdf,is this following code is correct for all format here i mention ?


Dim imageLicense As Aspose.Imaging.License = New Aspose.Imaging.License()
imageLicense.SetLicense(ConfigurationManager.AppSettings(“AsposeLic”))
Dim pdf As Pdf = New Pdf()
Dim MainSection As Aspose.Pdf.Generator.Section = pdf.Sections.Add()
Dim sample_image As Aspose.Pdf.Generator.Image = New Aspose.Pdf.Generator.Image()
sample_image.ImageInfo.File = inputfile
sample_image.ImageInfo.FixWidth = MainSection.PageInfo.PageWidth - MainSection.PageInfo.Margin.Left - MainSection.PageInfo.Margin.Right
sample_image.ImageInfo.FixHeight = MainSection.PageInfo.PageHeight - MainSection.PageInfo.Margin.Top - MainSection.PageInfo.Margin.Bottom
Dim myimage As Bitmap = New Bitmap(inputfile)
If (myimage.Width > MainSection.PageInfo.PageWidth) Then
MainSection.IsLandscape = True
Else
MainSection.IsLandscape = False
End If
MainSection.Paragraphs.Add(sample_image)
pdf.Save(outputfile)

3.One bmp to pdf convert file,but output not look like original bmg image in output pdf file.Here i attach that origianl file and output pdf file also,for your clarification.

4.Why still water mark appear in output pdf files? i am use Aspose.Total license(30 days temporary license),and license path correctly given,for word,excel to pdf ,in output pdf watermark not appear,but only in image to pdf watermark still appear.Here i also attach one image to pdf file output file.

5.I have one tiff file with 30 pages(in one tiff files like a word file have more than one pages).If i try to convert ,i can see only first page only convert and in output pdf file appear other pages are not appear in output pdf file.For security reason i cant attach that file here.


Pls reply asap

Note :inputfile is original file path
outputfile is where to be save output pdf file path,both are correct path,bcz in words and excel same like i give,it convert and save in mention folder.

DWG.rar to 1st question
cantconvert to 3rd question
19Aug2014093604.pdf to 4rth question


Regards
Aravind




Hi Aravind,


Thank you for contacting Aspose support.

In reference to question 1), we have noticed that the latest version of Aspose.Imaging for .NET 2.5.0 was unable to load your provided DWG files into an instance of Image for conversion. We have logged two tickets (one for each DWG sample) into our bug tracking system to further investigate the problem cause. Please find the ticket details as follow:

  • IMAGING-34316: EWKC0074.DWG
  • IMAGING-34315: BLDGPLAN.DWG

We are working on the other parts of your inquiry (related to Aspose.Pdf API), and we will shortly get back to you with updates in that regard.
Hi Aravind,

Aravindb:

2. I am try to convert all images files to pdf

ccitt,gif,jpeg,jpg,png,tif,tiff,bmp,emf,exif,icon,wmf to pdf,is this following code is correct for all format here i mention ?


Dim imageLicense As Aspose.Imaging.License = New Aspose.Imaging.License()
imageLicense.SetLicense(ConfigurationManager.AppSettings("AsposeLic"))
Dim pdf As Pdf = New Pdf()
Dim MainSection As Aspose.Pdf.Generator.Section = pdf.Sections.Add()
Dim sample_image As Aspose.Pdf.Generator.Image = New Aspose.Pdf.Generator.Image()
sample_image.ImageInfo.File = inputfile
sample_image.ImageInfo.FixWidth = MainSection.PageInfo.PageWidth - MainSection.PageInfo.Margin.Left - MainSection.PageInfo.Margin.Right
sample_image.ImageInfo.FixHeight = MainSection.PageInfo.PageHeight - MainSection.PageInfo.Margin.Top - MainSection.PageInfo.Margin.Bottom
Dim myimage As Bitmap = New Bitmap(inputfile)
If (myimage.Width > MainSection.PageInfo.PageWidth) Then
MainSection.IsLandscape = True
Else
MainSection.IsLandscape = False
End If
MainSection.Paragraphs.Add(sample_image)
pdf.Save(outputfile)


Please use new DOM approach to convert Image to PDF.


Aravindb:

3.One bmp to pdf convert file,but output not look like original bmg image in output pdf file.Here i attach that origianl file and output pdf file also,for your clarification.


I am afraid I am unable to open your shared PDF file, it seems it is corrupt. However, I have tested the scenario with new new DOM approach for the conversion without any problem.

Aravindb:

4.Why still water mark appear in output pdf files? i am use Aspose.Total license(30 days temporary license),and license path correctly given,for word,excel to pdf ,in output pdf watermark not appear,but only in image to pdf watermark still appear.Here i also attach one image to pdf file output file.


I am afraid I am unable to open the share PDF file for question, it seems it is corrupt. However, Please note you have to separately instantiate license object for every API. For example you need to instantiate license object of Aspose.Pdf API before instantiating any other object of Aspose.Pdf.

Aspose.Email.License licenseEmail = new Aspose.Email.License();

licenseEmail.SetLicense(licPath + "Aspose.Total.lic");

Aspose.Pdf.License licensePdf = new Aspose.Pdf.License();

licensePdf.SetLicense(licPath + "Aspose.Total.lic");

Aspose.BarCode.License licenseBarCode = new Aspose.BarCode.License();

licenseBarCode.SetLicense(licPath + "Aspose.Total.lic");

Aspose.Words.License licenseWords = new Aspose.Words.License();

licenseWords.SetLicense(licPath + "Aspose.Total.lic");

Aspose.Cells.License licenseCells = new Aspose.Cells.License();

licenseCells.SetLicense(licPath + "Aspose.Total.lic");

Aspose.Slides.License licenseSlides = new Aspose.Slides.License();

licenseSlides.SetLicense(licPath + "Aspose.Total.lic");


Aravindb:

5.I have one tiff file with 30 pages(in one tiff files like a word file have more than one pages).If i try to convert ,i can see only first page only convert and in output pdf file appear other pages are not appear in output pdf file.For security reason i cant attach that file here.


Please use new DOM approach and share the results, it will resolve the issue. If you still find any issue then please share your sample code for further investigation.

We are sorry for the inconvenience caused.

Best Regards,

Hi

Thank u for ur reply,

For 2,if i try to convert tiff file (6 mb ),it take long time to convert to pdf format and long length tiff file output is reduced in output file.pls check this post.

http://www.aspose.com/community/forums/567724/i-don-t-want-reduce-length-and-height-of-the-image-when-convert-to-pdf-format/showthread.aspx#567724
3 and 4 solved
5 if i use Dom approach 6 mb tiff (30 pages) file take long to convert pdf format


Regards
Aravind
Aravindb:

For 2,if i try to convert tiff file (6 mb ),it take long time to convert to pdf format and long length tiff file output is reduced in output file.pls check this post.



Hi Aravind,

Thanks for your inquiry. Please note Aspose.Pdf uses system memory for processing, it does not create any temporary files for the purpose. So processing time depends upon the system resources and content/size of the files.

Moreover in reference to output PDF file size you have to set page Width/Height size as suggest in your other post. Hopefully it will help.

Best Regards,

Hi

I am try to convert dwg to pdf,which i download sample file from this link pls check this files,most of the file cant convert,some file content are not full,and some file half of the image only show in out put

http://knowledge.autodesk.com/support/autocad/downloads/caas/downloads/content/autocad-sample-files.html

both AutoCAD 2011 Sample Files and AutoCAD 2010 Sample Files(23 files)


http://www.q-cad.com/samples/autocad-2d/samples/

9 files

And i am use follow code to convert dwg to pdf

Using image As Aspose.Imaging.Image = Aspose.Imaging.Image.Load(inputfile)
Dim pdfOptions As New PdfOptions()
pdfOptions.PageHeight = 1600
pdfOptions.PageWidth = 1600
’ pdfOptions.DrawType = CadDrawTypeMode.UseDrawColor
’ pdfOptions.DrawColor = Aspose.Imaging.Color.Red
pdfOptions.ScaleMethod = ScaleType.GrowToFit
image.Save(outputfile, pdfOptions)
End Using

Pls reply asap
Regards
Aravind

Hi Aravind,


Aspose.Imaging for .NET API currently supports for reading & converting AutoCAD 2004 DWG (version 16.0 Release 18) format only. Moreover, the support for AutoCAD primitive types is limited as outlined here. If you are getting partial rendering, the most probable reason would be that the particular drawing uses some primitives that are not supported at the moment. If Aspose.Imaging for .NET API is unable to load a DWG file (and throws an exception), that particular format may not be supported.

Please note, we are already working to gradually enhance the capabilities of Aspose.Imaging APIs by implementing other most recent DWG formats. With future releases, we are planning to deliver the support for binary & 2010 DWG formats.

Thank you for your understanding.

Hi

Thank you for ur information,currently it support AutoCAD 2004 (version 16.0 Release 18) format only.
When u going to update new API with latest version AutoCAD support(2010,2011…).

Regards
Aravind

Hi Aravind,


We are currently working to provide the support for AutoCAD version 2010. These enhancements will be published with the release of Aspose.Imaging for .NET 2.7.0, that is scheduled for the first quarter of October 2014. The support for AutoCAD version 2011 is scheduled for December 2014.

Please feel free to write back in case you have further concerns.

Hi Aravind,


This is to update you regarding the tickets logged earlier in reference to DWG to PDF conversion. Please find the details as follow.

  • IMAGING-34315: The sample BLDGPLAN.DWG has the AutoCAD 2000 data format that is currently not supported by Aspose.Imaging API. We are investigating the possibility to support this format with future releases, and we will keep you posted with updates in this regard. For now, we have enhanced the exception handling to throw appropriate messages when unsupported data formats are fed to Aspose.Imaging API.
  • IMAGING-34316: The sample EWKC0074.DWG corresponds to an ancient AutoCAD version - Release 10 (October 1988). We can not support this format as we don’t have the documentation explaining the data format structure for this revision of DWG. If you wish to process this sample with Aspose.Imaging API, you have to upgrade the DWG format to the version supported at the moment.

Please feel free to write back in case you have any concerns or questions.