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

Free Support Forum - aspose.com

How to delete rectangle data

I converted 03_目次_vsd file to jpeg and I got 03_目次_00000002.jpg however I can see blue line rectangle data in the jpeg.
In case that I save the vsd file as a pdf(03_目次_pdf) with Microsoft Visio, The blue line rectangle data is not shown.
I would like to get jpeg without blue line rectangle. Do you have any solution?

This is my code.

public static List ConvertVisioToImage(string docName, MemoryStream docStream, Dictionary config)
{
try
{
var pageInfoList = new List();

// Get config setting
string docRootDir = config["DocumentsFilePath"];
int dpi = int.Parse(config["ImageDPI"]);
int thumbMaxH = int.Parse(config["ThumbnailMaxHeight"]);
int thumbMaxW = int.Parse(config["ThumbnailMaxWidth"]);
int maxPageNum = int.Parse(config["DocumentMaxPageNum"]);
double readScale = double.Parse(config["ImageReadScale"]);
int readDpi = Convert.ToInt32(dpi * readScale);

// Create images directory
string pageImgDir = docRootDir;
if (!Directory.Exists(pageImgDir))
Directory.CreateDirectory(pageImgDir);

// Get the encoder of JPEG
ImageCodecInfo jpgEncoder = GetCodecInfo();
//EncoderParameters encParams = GetEncoderParams();

EncoderParameters encParams = GetEncoderParams(int.Parse(config["ImageJpegQuality"]));

// Instantiate the License class
Aspose.Diagram.License license = new Aspose.Diagram.License();
license.SetLicense("Aspose.Total.lic");

// Convert .doc and .docx file to PDF.
Diagram diagram = new Diagram(docStream);


//int totalPageCount = 0;
for (int i = 0; (i < diagram.Pages.Count) && (i < maxPageNum); i++)
{
// Export image file
if (diagram.Pages[i].Background == Aspose.Diagram.BOOL.True) { continue; }
var options = new Aspose.Diagram.Saving.ImageSaveOptions(SaveFileFormat.JPEG);
options.ExportHiddenPage = true;
options.PageIndex = i;
options.JpegQuality = int.Parse(config["ImageJpegQuality"]);
options.Resolution = readDpi;
string imgFile = string.Format("{0}_{1:D8}.jpg",
Path.GetFileNameWithoutExtension(docName), i + 1);
string imgPath = Path.Combine(pageImgDir, imgFile);
diagram.Save(imgPath, options);

// Add PageInfo List
pageInfoList.Add(imgPath);
}

// return results with flag of max page limit over
return pageInfoList;
}
finally
{
}
}

Thank you,
Atsuo Nakatani

Hi Atsuo,


Thank you for contacting support. Your source code is not in fully compilable form. GetCodecInfo and GetEncoderParams methods are unknown. Kindly provide the complete code of these two methods. It will help us to replicate the same scenario on our side. Your response is awaited.

Hello Imran,

Sorry for bother you, the 2 methods are not necessary. please comment out them.

This should work fine.

public static List ConvertVisioToImage(string docName, MemoryStream docStream, Dictionary config)
{
try
{
var pageInfoList = new List();

// Get config setting
string docRootDir = config["DocumentsFilePath"];
int dpi = int.Parse(config["ImageDPI"]);
int thumbMaxH = int.Parse(config["ThumbnailMaxHeight"]);
int thumbMaxW = int.Parse(config["ThumbnailMaxWidth"]);
int maxPageNum = int.Parse(config["DocumentMaxPageNum"]);
double readScale = double.Parse(config["ImageReadScale"]);
int readDpi = Convert.ToInt32(dpi * readScale);

// Create images directory
string pageImgDir = docRootDir;
if (!Directory.Exists(pageImgDir))
Directory.CreateDirectory(pageImgDir);

// Get the encoder of JPEG
//ImageCodecInfo jpgEncoder = GetCodecInfo();
//EncoderParameters encParams = GetEncoderParams();

//EncoderParameters encParams = GetEncoderParams(int.Parse(config["ImageJpegQuality"]));

// Instantiate the License class
Aspose.Diagram.License license = new Aspose.Diagram.License();
license.SetLicense("Aspose.Total.lic");

// Convert .doc and .docx file to PDF.
Diagram diagram = new Diagram(docStream);


//int totalPageCount = 0;
for (int i = 0; (i < diagram.Pages.Count) && (i < maxPageNum); i++)
{
// Export image file
if (diagram.Pages[i].Background == Aspose.Diagram.BOOL.True) { continue; }
var options = new Aspose.Diagram.Saving.ImageSaveOptions(SaveFileFormat.JPEG);
options.ExportHiddenPage = true;
options.PageIndex = i;
options.JpegQuality = int.Parse(config["ImageJpegQuality"]);
options.Resolution = readDpi;
string imgFile = string.Format("{0}_{1:D8}.jpg",
Path.GetFileNameWithoutExtension(docName), i + 1);
string imgPath = Path.Combine(pageImgDir, imgFile);
diagram.Save(imgPath, options);

// Add PageInfo List
pageInfoList.Add(imgPath);
}

// return results with flag of max page limit over
return pageInfoList;
}
finally
{
}
}

Thank you,
Atsuo Nakatani

Hi Atsuo,


Thank you for the details. Without setting JPEG quality and resolution (as we do not know the values which you are passing in the parameter), Aspose.Diagram API renders this blue colored rectangle whereas Microsoft Visio 2013 application does not render it. We have logged an investigation under ticket ID DIAGRAMNET-51215 in our bug tracking system. Your post has also been linked to this ticket. We shall keep you informed regarding any available updates. We are sorry for the inconvenience caused.

As a workaround, you can assign Visio shapes a Layer, and then set visibility of the Visio layer to false/true. Please refer to this help topic: Working with Layers

Hi Atsuo,


Thank you for being patient. We have a good news for you that the ticket ID DIAGRAMNET-51215 has been resolved. If there is no issue in the quality assurance phase, then this fix will be included in the next version 17.4.0 of Aspose.Diagram for .NET API. We shall inform you via this forum thread as soon as the new release is published.

The issues you have found earlier (filed as DIAGRAMNET-51215) have been fixed in Aspose.Diagram for .NET 17.4.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan