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

Free Support Forum - aspose.com

Multiple images are behind each other?

I want to use Aspose.note for automating digitalization:

- taking images
- then move to onenote
- grab text of images

I am evaluation Aspose.note right now.

When I use the API I get the following issues:
- Large images result in a CROSS
- Smaller images are not showing after each other (vertical) but really hidden behind
- When using smaller images the OCR recognition does not work properly

Can someone help me on any of the three above issues?

The application code i use right now is the following:
private void SendToOneNote(string pFolder)
{
// document and page
int doccount = 1;
string dataDir = pFolder + “\Document” + doccount.ToString(“0”) + “.one”;

//Aspose.Note.License lic = new Aspose.Note.License();
//lic.SetLicense(SmashIconApp.License.LStream);

string[] files = Directory.GetFiles(pFolder);
Document doc = new Document();
Page page = new Page(doc);
// Add Page node
doc.AppendChild(page);

// Default style for all text in the document.
TextStyle textStyle = new TextStyle { FontColor = Color.Black, FontName = “Arial”, FontSize = 10 };
// Set page title properties
page.Title = new Title(doc)
{
TitleText = new RichText(doc) { Text = “Title text.”, DefaultStyle = textStyle },
TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString(“D”, CultureInfo.InvariantCulture), DefaultStyle = textStyle },
TitleTime = new RichText(doc) { Text = “12:34”, DefaultStyle = textStyle }
};

// Initialize OutlineElement class object
OutlineElement outlineElem = new OutlineElement(doc);
// Load the second image using the image name, extension and stream.

// Initialize Outline class object and set offset properties
Outline outline = new Outline(doc)
{
VerticalOffset = 0,
HorizontalOffset = 0
};


if (files != null && files.Count() > 0)
{
int num = 0;
foreach (string file in files)
{
num++;
if (num % 50 == 1)
{
if (num > 1)
{
// Add outline elements
outline.AppendChild(outlineElem);
// Add Outline node
page.AppendChild(outline);

doc.Save(dataDir);
doccount++;
dataDir = pFolder + “\Document” + doccount.ToString(“0”) + “.one”;
}
doc = new Document();
page = new Page(doc);

// Default style for all text in the document.
textStyle = new TextStyle { FontColor = Color.Black, FontName = “Arial”, FontSize = 10 };
// Set page title properties
page.Title = new Title(doc)
{
TitleText = new RichText(doc) { Text = “Title text.”, DefaultStyle = textStyle },
TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString(“D”, CultureInfo.InvariantCulture), DefaultStyle = textStyle },
TitleTime = new RichText(doc) { Text = “12:34”, DefaultStyle = textStyle }
};
// Add Page node
doc.AppendChild(page);

// Initialize OutlineElement class object
outlineElem = new OutlineElement(doc);
// Load the second image using the image name, extension and stream.

// Initialize Outline class object and set offset properties
outline = new Outline(doc)
{
VerticalOffset = 0,
HorizontalOffset = 0
};

}
string path1 = Path.GetDirectoryName(file);
string file1 = Path.GetFileNameWithoutExtension(file);
string ext1 = Path.GetExtension(file);

try
{
// resize to 50%
System.Drawing.Image img1 = System.Drawing.Image.FromFile(file);
System.Drawing.Image thumb1 = img1.GetThumbnailImage((int)(img1.Width / 10.0), (int)(img1.Height / 10.0), null, IntPtr.Zero);
string thumb1file = Path.GetTempFileName() + “.png”;
//page.Height += (thumb1.Height + 20);
thumb1.Save(thumb1file, System.Drawing.Imaging.ImageFormat.Png);
thumb1.Dispose();
img1.Dispose();
//Directory.SetCurrentDirectory(path1);
//FileStream fs = new FileStream(file, FileMode.Open);
Aspose.Note.Image image = new Aspose.Note.Image(doc, thumb1file);
// Set image alignment
image.Alignment = Aspose.Note.HorizontalAlignment.Left;
//image.Height = 200;
//image.Width = 150;
// Create an object that inherits from the DocumentVisitor class.
// Add image
outlineElem.AppendChild(image);
}
catch (Exception e)
{
}

if (num == 49)
break;
}

// Add outline elements
outline.AppendChild(outlineElem);
// Add Outline node
page.AppendChild(outline);

doc.Save(dataDir);
doccount++;
dataDir = pFolder + “\Document” + doccount.ToString(“0”) + “.one”;
}
}

Hi Smash,


Thank you for writing to Aspose Support team.

Please try Image.HorizontalOffset and Image.VerticalOffset properties to adjust image position. If this doesn’t meet your requirements, could you please add your sample code to a console application, add your sample images to it and share that application with us for further investigation at our end? We’ll look into it for assisting you further.