Hello,
I've been using your SDK for evaluation before purchase, and looks like your SDK cannot handle or preview larger document file.
Currently using version : 2.18.0.25786
Here is the sample code :
************************ office_viewer_title.cs
private void OfficeDocumentViewer_Load(object sender, EventArgs e)
{
office_viewer_title.ActiveForm.Text = "Office & PDF Document Viewer";
this.WindowState = FormWindowState.Maximized;
user_control_for_view = new ViewerUserControl();
string license_path = System.Reflection.Assembly.GetExecutingAssembly().Location.ToString();
var directory = Path.GetDirectoryName(license_path);
System.GC.Collect();
Groupdocs.Web.UI.Viewer.SetLicensePath(directory + "\\GroupDocs.Viewer.lic");
user_control_for_view.ShowToolStrip(true);
user_control_for_view.ShowMainMenu(false);
user_control_for_view.SetPageImageQuality(10);
user_control_for_view.Dock = DockStyle.Right;
user_control_for_view.HorizontalScroll.Enabled = true ;
user_control_panel.Controls.Add(user_control_for_view);
System.GC.Collect();
// this.Controls.Add(user_control_for_view);
this.Size = Screen.PrimaryScreen.WorkingArea.Size;
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
converted_text_data.Clear();
OpenFileDialog document_file_browser = new OpenFileDialog();
document_file_browser.Filter = " Microsoft Document|*.docx| Microsoft Excel|*.xlsx;*.xls| Microsoft Powerpoint|*.pptx| Adobe PDF|*.pdf| Image Formats |*jpg;*png;*.bmp;*.dib;*jpeg |Others |*.*";
document_file_browser.Title = "Select Microsoft Office File";
if (document_file_browser.ShowDialog() == DialogResult.OK)
{
try
{
File = document_file_browser.FileName;
user_control_for_view.OpenDocument(File);
document_pre_label.Visible = false;
File_Extension = Path.GetExtension(File);
//for Microsoft Word
if (File_Extension == ".docx" || File_Extension == ".doc")
{
//Groupdocs.Engine.Documents.WordsDocument word_document = new Groupdocs.Engine.Documents.WordsDocument();
//word_document.Open(File);
try
{
DocumentTextExtractor textExtractor = new DocumentTextExtractor(File);
Text = textExtractor.GetDocumentText();
converted_text_data.Clear();
converted_text_data.ScrollBars = ScrollBars.Vertical;
txt_data_label.Visible = false;
converted_text_data.Text = Text;
user_control_for_view.Refresh();
System.GC.Collect();
//Groupdocs.Engine.Documents.Extractors.WordsTextExtractor document_text = (Groupdocs.Engine.Documents.Extractors.WordsTextExtractor)word_document.TextExtractor;
// Text = document_text.Extract();
//converted_text_data.Clear();
//converted_text_data.ScrollBars = ScrollBars.Vertical;
//converted_text_data.Text = Text;
}
catch (Exception)
{
converted_text_data.Text = "*Word file content is in Image format, can't convert to text";
//converted_text_data.Font = new Font("Comic Sans MS", 10);
converted_text_data.ForeColor = Color.Red;
}
}
}
catch(Exception ex)
{
}
}
}
*********************************************************Program.cs
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new office_viewer_title());
}
}
-------------------------------------------------------------------------------------------------------------------
When i provide Microsoft (docx) file of 25MB, its throws an exception of Value of '0' is not valid for 'Value'. 'Value' should be between 'minimum' and 'maximum'.
And when i provide smaller file like 1-2 MB it previews ok.
Please help me if i am doing wrong, and we need this solution ASAP, we are already behind our schedule.
Thank You.
Regards,
Alan