Free Support Forum - groupdocs.com

Render documents as image and download as PDF using .NET

Hi,
group docs viewer showing individual images of the document.when i click next/prev it will render and load next page as a image in viewer…

i need to combine those images as a file and download.

how to combine in one file and download

https://dev.to/usmanaziz/how-to-create-a-document-viewer-in-asp-net-c-24b6

followed like this example…when i click download,i have a image list of the particular document.need to combine them as a one document and download.if it is .Pdf document should saved as a Test.Pdf.

1 Like

@bharathiGK,

Please take a look at this video demonstration. Hopefully, it will meet your requirements. You can download this showcase project here.

I gone through those examples.That is not suitable to my requirement.i am loading document using pngviewer page by page of document.initially document of first page only loaded.when i click next ,the second page convert as a image and gets load…in this scenario i need to combine images into one file( .docx / .pdf) while downloading… during download i can get list of images,so that time i need to combine files

1 Like

@bharathiGK,

We are investigating this scenario at our end. Your investigation ticket ID is VIEWERNET-2421. As there’s any update, you’ll be notified.

@bharathiGK,

One of the possible solutions for VIEWERNET-2421 is you can render source document to images and view them using UI by pressing next or back buttons. But on download click event you can convert/render document to PDF format at back-end and then download it.
You can convert any number of pages into PDF see this and this documentation articles. So when you need to convert let’s say first three pages to PDF you do the following:

int[] pageNumbers = new int[] { 1, 2, 3 };
using (Viewer viewer = new Viewer("sample.docx"))
{
    PdfViewOptions viewOptions = new PdfViewOptions();
    viewer.View(viewOptions, pageNumbers);
}   

and for all pages:

using (Viewer viewer = new Viewer("sample.docx"))
{
    PdfViewOptions viewOptions = new PdfViewOptions();
    viewer.View(viewOptions);
}

HI.I have rendered source document to images and stored in image cache.when i click download, i’m getting image List from imagecache folder,those images should be joined or combined in an .pdf file or .docx then it should download.

1 Like

@bharathiGK,

The best option would be to create PDF document from the source document and then download the PDF. The following code converts file to PDF:

using (Viewer viewer = new Viewer("sample.docx")) 
{ 
       PdfViewOptions viewOptions = new PdfViewOptions(); 
       viewer.View(viewOptions); 
}

Unfortunately, GroupDocs.Viewer API doesn’t provide any such feature to merge/join the images into PDF or DOCX. However, you may look at GroupDocs.Merger API.

Okay…i Gone through merge Api. In that there is no possibility…

@bharathiGK,

We also shared a workaround with you. You can render images, view them by pressing next/previous buttons. And when you press download button, convert the source document into PDF at back-end, download it.

Eventually, you want a PDF as downloaded file. So, above mentioned is one of the possible solution.

Actually in my case, Source document is an Original Documents,That doesn’t have highlights,watermark and all…So viewer images only had those,that’s why i’m looking for combining images.When i download ,the document should has the Highlights,watermark and redact and all

@bharathiGK,

We are afraid but GroupDocs.Viewer for .NET doesn’t provide any such feature.

That’s Okay.i got aspose.words provides a feature for combine images into pdf…i used that now

1 Like

@bharathiGK,

Glad to know that your issue is resolved.