We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF Viewer interface

Hello,

We are looking for the component that provide interface to view PDF files.

Any code sample for that component will realy helpfull for us.

Thanks,

Sanjay

Hi Sanjay,

Aspose.Pdf.Kit for .NET provides a class named PdfViewer which allows you to view and print PDF files. You can decode all PDF pages to images and then view those images using any image control in your web or desktop applications.

Please find the details on the following links and explore it at your end:
PdfViewer class
PdfViewer Details
Printing PDF files using PdfViewer
DecodePage Method - To decode single page to Bitmap
DecodeAllPages Method - To decode all pages to Bitmap array

Also, please have a look at the following code snippet:


//open PDF file

PdfViewer pdfViewer = new PdfViewer();

pdfViewer.OpenPdfFile(“input.pdf”);

//decode all pages

Bitmap[] bitmapList = pdfViewer.DecodeAllPages();

pdfViewer.ClosePdfFile();

I hope this helps. If you have any further questions, please do let us know.
Regards,



Thanks Shahzad we are working around above code.

Our main concern is the quality of the generated image in every manner. Right now if we zoom this image its content got blurred, not readable properly.

Do you have to know any option available in PDFViewer or other class that use to set quality releated option of generated image (like dpi, quality index, resolution etc.)

PFA is the screen shot of image in zoom.

Please let us know quickly if we need to use some other code snippet.

Thanks,

Sanjay

Hi Sanjay,

You can set Resolution property of the PdfViewer class to a higher value to get a better quality output. Moreover, you can use PdfConverter class to convert a PDF file, or individual pages, to images; please try this class as well to see if produces a better quality output for you. Please also see the following help topic for better understanding:
Manipulating Images in an Existing PDF File

I hope this helps. If you still find any issue or have some more questions, please do let us know.
Regards,

Thanks a lot shahzad, Resolution property gives us qualitative output as per our expectation.

One more thing may be create problem for us is the size of image. Resolution property of image is directly proposational to the size. If we increased the resolution of image, size also get increased.

May i know any option available in "Aspose.Pdf.Kit.PdfConverter" that produce less size and high quality output image.

Thanks,

Sanjay

Hi Sanjay,

I’m afraid, there is a trade-off between quality of the output image and its size; so, it is difficult for us to reduce the output file size while improving the quality.

As far as PdfConverter class is concerned, it also provides Resolution property; you might need to try that at your end. You can also try using this overload of GetNextImage to specify the dimensions and quality of the output image. Please try it at your end.

I hope this helps. If you still find any issues or have some more questions, please do let us know.
Regards,



I don’t think it would be possible without using a PDF viewer browser component that the user installs (such as adobe reader) unless the file is stored as a vector image file. Without components, the browser can’t really display much.

With HTML 5 and standardized vector graphics, this will be more doable without 3rd party installations. Until then, the best way to do this is via image file or 3rd party viewer.