Question:
I know PDF WebViewer (PDFNetJS) can display PDF files directly, but are there other formats supported client side?
Answer:
Yes, there are a number of image formats supported. Here is the breakdown.
PNG, JPEG
If your URL does not have a proper image extension, then you can do the following.
myWebViewer.loadDocument("mydomain/generic_url_to_image", {filename: "input.png"})
This works with both PDFNetJS Lean and Full editions.
TIFF, GIF, JP2 or Multiple PNG/JPG.
This is possible, using PDFNetJS Full edition, which does not come with the regular WebViewer download.
Using PDFNetJS Full you would follow the
AddImage sample code to construct a PDF with the image(s) in it.
Another option, which you can use with the PDFNetJS Lean version (not the full version) is to use a 3rd party library that can convert the image format to HTML5 canvas, then from the HTML5 canvas you can get a PNG. For instance, for TIFF files the following library will load it into a HTML5 canvas
https://github.com/seikichi/tiff.js