Error when loading certain tiff files (not able to convert to PDF)

Product: WebViewer

Product Version: 8.7.0

Please give a brief summary of your issue:
(Think of this as an email subject)
Error when loading certain tiff files (not able to convert to PDF)

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
When loading certain tiff files, the below error is returned:

webviewer-core.min.js:211 Uncaught (in promise) Exception: 
	 Message: An error occurred while converting the TIFF.
Detailed error:
	Exception: 
	 Message: Unable to convert non-TIFF image to PDF using the FromTiff API
	 Conditional expression: filter.get()
	 Version      : 9.3.0-0be415464
	 Platform     : Emscripten
	 Architecture : Emscripten
	 Filename     : Convert.cpp
	 Function     : FromTiff
	 Linenumber   : 1602

	 Filename: Convert.cpp
	 Function: FromTiff
	 Linenumber: Ϳ��>ڂa�?

The error seems to indicate that the API doesn’t recognize the files in question as .tiff files. They are in fact tiff files. This happens for some tiff files but not others. As far as I can tell, there’s nothing unique about the tiff files that throw the error. It throws the error consistently for the problem files and works consistently for the non-problem files.

This was happening in version 7.2.0 of the Web Viewer and also after upgrading to 8.7.0.

When using 7.2.0, our code very similarly resembled the example here: PDFTron Systems Inc. | Documentation

However, the 8.2.0 patch notes indicate that client side support was added for tiff files. PDFTron Systems Inc. | Documentation
I took this to mean that the loadDocument function can inherently handle tiff files. In our 8.7.0 code, I load tiff files the same as I do regular documents (without any of the explicit conversion calls using PDFNet). I still get the same error, which I assume means the PDF conversion is being called behind the scenes by the loadDocument function. We are using the full version of the API.

Our basic load call looks like this:

	webViewer.Core.documentViewer.loadDocument(data.source, {
		docId: data.id,
		filename: data.name,
		onError
	});

Without the PDFNet code to explicitly convert tiff files, the problem ones are still failing and the ok ones are still working. The only difference I’ve noticed is that now .tif files won’t load (as opposed to .tiff). Any help would be greatly appreciated.

Please provide a link to a minimal sample where the issue is reproducible:

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Would you be able to share this .tiff file?

Hi Sardor,
Unfortunately the image contains patient medical information, so I’m not able to share it. I understand that this is a very vague issue. Would providing image metadata help?

Hello @nick.herbert
Since this only happens with some files, the investigation process would be way quicker if we could use a sample file that triggers the issue. Would it be possible to redact that information and send me the file? If you would like you can email the file to support@pdftron.com and mention this ticket.

In trying to remove sensitive information from the files we’ve discovered their MIME type is actually PNG but the extension is tiff, which seems to be the cause of the error. This is a problem without own users’ process. It may be helpful for PDFTron to check the mime type instead of the extension for any tiff conversion, but I understand that’s not a requirement on your end. Thank you for your time.