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