Group Docs Viewer SDK not able to preview version 2.18.0.25786

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
1 Like

Hi Alen,


We are sorry to hear that you have such issue. Could you please share the example of the document which is fails.

Thank you.

In addition to previous post.


After checking your code I can see that you use GroupDocs.Viewer only to set the license for it and then you extract the text from the document with Viewer method Text = textExtractor.GetDocumentText(); and if I understand your use case correctly - you want to view the extracted text with your code.

Is it correct?

Best regards.
Hello Team,

Have you seen in the code that i have added your SDK Viewer control to my windows form control, so as per reading your documentation it says when we provide file to your viewer user control, it does the viewing part automatically.

Please skip the text extraction part from my previous code, please refer this code
Groupdocs.WinForms.UI.ViewerUserControl user_control_for_view;

user_control_for_view.OpenDocument("docx_file_path");

document_pre_label.Visible = false;
user_control_for_view.ShowToolStrip(true);
user_control_for_view.ShowMainMenu(false);
user_control_for_view.SetPageImageQuality(10);
user_control_panel.Controls.Add(user_control_for_view);

Here the user_control_panel is Windows Form Panel , i've just added your control to Windows form panel that it.


And the second, about the docx file you want, you can create a large sample of 25MB at your end and test it.

Please correct me if i am doing any thing wrong in the code.

Looking forward to hear you.

Thank You.

Regards,
Alan.

Hi Alan,


Thank you for the clarification. I was able to reproduce the issue.

We have released a next generation Viewer library and since that I can recommend you to migrate on it if possible. For more info about it please check this documentation and examples . Also your issue could be resolved in the new library. If you will have any issues or questions about it please make a new forum request and mark it as related to the Viewer 3.0

Thank you.

Hello Team,


Thanks for the response, i will try it.

And using this SDK, is it also possible to extract text data too from word file, for opening word file using your SDK and extract text data into string ?

Please let me know about it.

Thank You.

Regards,
Alan/

Hi Alan,


Thank you for asking. If you mean to get document text using the legacy Viewer library (2.x version) then yes - you can get document text as you do, for example:

DocumentTextExtractor textExtractor = new DocumentTextExtractor(path);
string Text = textExtractor.GetDocumentText();

If you mean is it possible in the Viewer 3.0 - then yes, it should be possible too.

Since you have not implemented it in the ready for use application yet - we strongly recommend you to migrate to the new version of the library

Best regards.

Hello,


Thanks for the prompt response.

I have one query that using your latest SDK is there any view user control, like in your older version 2.18, in latest SDK look like you are doing docx to html or image formats conversion only, so can you please tell me how to use or is there any view user Control in the latest version , so that i just have to load the file and add your user control in frame of Windows Form.

Please direct me on this, looking forward to hear you.

Thank You.

Regards,
Alan
Hello Team,

I have tried your SDK, and tried to convert Microsoft Document(docx) file into images, but at time of "List Images = imageHandler.GetPages(guid, options);", its throws an exception of ""
The Microsoft Word(docx) file is around 31MB and in that there are total 30,550 pages.

And also the memory comsumption is too high, it takes around 1GB of RAM to process and after that it throws exception.

I have also attached screenshot, please find the screenshot in the attachment.


Here is the sample of code using your SDK

try
{

String File_path = "C:\\sample_31_mb_.docx";


ViewerConfig config = new ViewerConfig();
config.UseCache = true;
config.StoragePath = "C:\\temp\\storage_path";

ViewerImageHandler imageHandler = new ViewerImageHandler(config);

string guid = File_path;

ImageOptions options = new ImageOptions();

List Images = imageHandler.GetPages(guid, options);


foreach (PageImage image in Images)
{
SaveAsImage("C:\\output\\temp_" + image.PageNumber + ".Jpeg", image.Stream);
}


}
catch(Exception ex)
{
}

Can you please tell, if i have done anything wrong, and for sample you can create/must be having for microsoft document of at least 20,000 pages, and sorry i can't upload sample file from my side due to company policy.

I have also tried the same with html conversion option sample problem.

Please assist, we are already behind our schedule.

Thank You.

Regards,
Alan

Hi Alan,


Thank you for trying the new version. Since the new library have nothing with the legacy one (2.x version) could you please make a new forum request with these two questions and mark it with 3.0 version in the subject,

Thank you.

Hello Team,


I’ve post a new thread as request, please see my new post in above link:

http://groupdocs.com/Community/forums/11148/using-groupdocs-viewer-3.0-latest-version-having-issues/showthread.aspx#11148

Please provide solution ASAP , as we are behind our schedule, so suggest you to take this case on priority.

Thank You.

Regards,
Alan

Hi Alan,


Thank you for posting. We will investigate the issue and reply you ASAP.

Best regards.