Option to view eml disappear

Hi, one year ago I’ve updated Groupdocs.Viewer.dll with version 17.12 from version 17.7.0. On the ViewerConfig object there was a property called “UsePdf” that I used to correctly view eml files with long text (more than a page). In 17.12 this property does not exists anymore and now I noticed that eml files with long text are not viewed correctly anymore.
Can you tell me how to restore that behavior that 'til one year ago with 17.7.0?

Another question about eml files: I have an eml files that contains external links that are blocked by the system administrator so when the viewer try to view it, it’s freezing. Is there a sort of timeout that stops the file from loading after n seconds?

Thank you

@gian_boscolo_hotmail_it,

Thanks for posting your inquiry.

Since version 17.8, UsePdf property has been removed from ViewerConfig class. Please use ImageOptions.ExtractText property instead. For more details, please visit this documentation article.

I am afraid that the API doesn’t provide any built-in feature to meet your requirement, therefore, you will have to implement your own logic for this. In case you would have any other question or query, please do let us know.

Hi, I have tried to use the property ExtractText on the ImageOptions object and also on the DocumentInfoOptions object. With ImageOptions.ExtractText I have the same problem: the eml is not displayed in all its length. With DocumentInfoOption.ExtractText I see that there is two page that are loaded but only the first is viewable, the second page is always on loading. On the viewer temp folder I see that it’s created a pdf file with 2 pages that represents the email and also another folder with 2 png files and they are correctly created (I can see the second page of the eml). Can you help me?

For the second question: can you tell me if exists a timeout to set on the client side? So after tot minutes I can cancel the operation of visualization?

Thanks

@gian_boscolo_hotmail_it,

Thanks for coming back to us.

Please share with us the problematic eml file and tell us the version of GroupDocs.Viewer for .NET you are using. In case you are using any of our open source document viewer applications, please share its name.

Would you please elaborate your scenario in more details that when and how you want to cancel the document loading/visualization?

Hi, it’s based on this https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET-MVC-App/tree/master/Viewer-Modren-UI#start-of-content. The file that creates the problem is attached. The version of Groupdocs.Viewer.dll is 17.12.0.0

For the second question: I want to cancel when it takes more than tot seconds to load the document, so I can handle this problem by showing the user a message in which he can download the file that can not be viewed.

Thank you

EML_esempio.zip (4.7 KB)

@gian_boscolo_hotmail_it,

Thanks for providing the required details.

We have tried to render your provided eml file and the API is rendering both pages without any issue. The issue exists in your mentioned document viewer application, however, I am afraid that this application is obsolete now and its support has been discontinued. Therefore, we recommend you to please try and migrate to our latest document viewer application in which your reported issue has been fixed. You can download the application from here.

One possible way to implement the timeout would be using System.Threading.Tasks.Task class in the back-end code as shown in the following code sample.

var task = Task.Run(() => RenderAsImage("candy.pdf"));
if (task.Wait(TimeSpan.FromSeconds(2))) // set timeout in seconds 
{
       // document rendered successfully.
}
else
{
     //throw new Exception("Timed out");
     // Show timeout message.
}
//====================
public static void RenderAsImage(string DocumentName)
{
    // Set configurations
    ViewerConfig config = new ViewerConfig();
    config.StoragePath = @"D:\storage\";
    config.EnableCaching = true;
    // Create image handler
    ViewerImageHandler imageHandler = new ViewerImageHandler(GetConfigurations());
    string guid = DocumentName;
    // Set image options
    var imageOptions = new ImageOptions();
    imageOptions.ExtractText = true;
    // Get pages
    List<PageImage> AllPages = imageHandler.GetPages(guid, imageOptions);
}

Hope it helps.