How document viewer API works in .NET

Hello again.

Please download ppt file from this drive link

@vinaybhatt

Thank you for sharing the sample file, we’ll take a look and update you. To upload the file you can use the button highlighted at the screenshot.

@vinaybhatt

I was using this sample_app.zip (1.6 KB) to reproduce the issue and it took 45 seconds to complete the job see rendering_to_html.png and 15 seconds with fonts excluded see rendering_to_html_exclude_fonts.png. Exclude Fonts feature can be used when you need better performance and you can pay with a quality of the output.

Could you please share the version of GroupDocs.Viewer and a code that you’re using for further investigation?

Thanks for reply

I have checked at my end and it takes 101 seconds with font and 26 seconds excluding fonts
But we can not exclude fonts neither we can compromise with quality. So are there some settings to boost this? or there is any way to fetch pages using pagination (I mean if there are 100 pages then we can get 10 pages first then next 10 pages and so on)?

Thanks again

And one more thing, Images quality gets down can we keep it as original from any settings.

@vinaybhatt

Sure, the View method accepts an array of page numbers as a second parameter, so you can fetch any pages you need.

int[] firstTenPages = Enumerable.Range(1, 10).ToArray();
//or int[] firstTenPages = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

using (Viewer viewer = new Viewer(fileName))
{
    HtmlViewOptions viewOptions = 
        HtmlViewOptions.ForEmbeddedResources();
    viewer.View(viewOptions, firstTenPages);
}

The following is also valid

viewer.View(viewOptions, 1, 2, 3);
viewer.View(viewOptions, 3, 2, 1);
viewer.View(viewOptions, 1, 3, 5);

This issue has been logged in our bug tracker with ID VIEWERNET-3312. We’ll check it an update you.

Hi @vinaybhatt

Might you attach samples of bad-quality images here? And if you can your code?

Thanks @vladimir.litvinchik

We can know if advance that how many pages will be there after conversion of a document (using any function of groupdoc), so that paging can be prepared accordingly.

Hello @mikhail.evgrafov.aspose

Yes sure i am uploading original and converted image along with this reply.

Please check

Orignal_Img.PNG.jpg (175.2 KB)
Converted_Img.PNG.jpg (119.7 KB)

Thanks
Vinay Bhatt

Hi @vinaybhatt

I checking different implementation results, I will write here when I complete.

@vinaybhatt

Yes, you can use GetViewInfo method that will return a list of pages that will be there after conversion of a document.

using (Viewer viewer = new Viewer(fileName))
{
    ViewInfoOptions viewInfoOptions = ViewInfoOptions.ForHtmlView();
    // or ViewInfoOptions.From* method if you already have HtmlViewOptions
    // ViewInfoOptions viewOptions = ViewInfoOptions.FromHtmlViewOptions(htmlViewOptions);

    ViewInfo viewInfo = viewer.GetViewInfo(viewInfoOptions);

    Console.WriteLine($"Count pages: {viewInfo.Pages.Count}");
}

Hi @vinaybhatt

I also want to clarify - these screenshots of final HTML or PNG converted? Which output format - HTML or PNG?

Hello @vladimir.litvinchik

Thank you for our help.

Hello @mikhail.evgrafov.aspose

Converted screenshots are HTML one.

Thanks
Vinay Bhatt

Hi @vinaybhatt

What OS you are using?

Hi @vinaybhatt

We reproduced your issue with low-quality images in HTML. As there’s any update, you’ll be notified.

Hello @mikhail.evgrafov.aspose

OS - Window and Linux Both

Thanks

Hi @vinaybhatt

Thank you for your response, we investigating your issue.

@mikhail.evgrafov.aspose

Did you find the root cause for earlier issue?

One more issue - After converting the document (HTML View), system converts/picks document conent only it does not includes full page like margins etc.

I have used below options -

HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);
options.RenderResponsive = true;
options.PdfOptions.RenderOriginalPageSize = new PdfOptions().RenderOriginalPageSize;
options.PdfOptions.EnableLayeredRendering = true;

Please let me know if i am missing something, moreover i am attaching orignal and converted document snap shot.

convertedDoc_image.PNG (76.2 KB)
orignalDoc_image.PNG (101.9 KB)

Thanks
Vinay Bhatt

@vinaybhatt

The issue with image quality is under investigation at the moment. We’ll let you know when we have any updates.

When rendering DOC/DOCX files the following options do not have effect as they are only related to rendering of PDF fils

options.PdfOptions.RenderOriginalPageSize = false;
options.PdfOptions.EnableLayeredRendering = true;

Unfortunately I can’t reproduce the issue, this is how the first page of the sample.docx.zip (63.9 KB) looks in the browser and the margins are honored.

Could you please attach the sample file that you’re rendering for the further investigation.