Unable to convert file from binary to form

Product:
PDFTron Webviewer
Product Version:
8.8.0
Please give a brief summary of your issue:
Unable to convert this document from binary to OOXML file is not a valid zip archive

Please describe your issue and provide steps to reproduce it:
Unable to convert this document from binary to OOXML file is not a valid zip archive. This issue is happening to the demo version i deployed on an IIS server of which the same code was running fine on my machine before deploying it is happening for all the file types word and excel then for pdf files its writing: Message: PDF header not found. the file is not a valid PDF file of which i can open these files with other document viewing applications

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


1 Like

Hi leonmuzire96,

If I am understanding correctly, you are trying to convert a binary document to an office document on WebViewer? Which demo are you following for the conversion?

Here are the currently supported file formats for WebViewer:

The exception you see is because the file you are trying to open is not a PDF, you can see a related forum post here:

Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

Below is the code snippet that i’m using angular integration with WebViewer, The logic is successfully loading on my PC but giving issues when deployed on IIS Server

WebViewer({

  path: 'assets/lib',
  initialDoc: 'assets/docs/Details Report -Files Share Information-file (1).pdf'

}, this.viweChildRef.nativeElement).then(instance=>{
  const { documentViewer, Annotations, annotationManager } = instance.Core;
  const { setHeaderItems, enableElements, disableElements, enableFeatures, disableFeatures, setTheme, Feature } = instance.UI;
  const annotation = annotationManager;

. . . . .
}

Hi leonmuzire96,

The WebViewer constructor looks correct so there shouldn’t be any issues there.

Could you try uninstalling you current version of WebViewer and install the latest version and see if the issue persists?

Can you also provide the files that are causing these exceptions?

Thank you in advance.

Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.

hi @leonmuzire96 did u manage to fix this problem? I have been getting the same error, every time i change the URL/filepath when reading a DOCX file, but when i load the file at the start if loads fine it just pups every time it changes.

1 Like

Try to create and load document normally without using any webViewerOption first (no ‘extension,’ ‘filename,’ ‘initialDoc,’ etc.).

const document = await instance.Core.createDocument(documentURL);
instance.UI.loadDocument(document);

If it works, then there’s something wrong with extension of the file.

For example, maybe the content your office file is not an office file, but PDF file. If you try to open a PDF file whole name is document.docx, then you pass ‘docx’ to ‘extension’ option, then you will get the ‘Exception during conversion’ error.

On the other hand, if your filename is document.pdf, but the content inside is docx, you will get error PDF header not found.

did you use WebViewerOption ‘extension’ ???
If not, WebViewer will guess the file extension from your URL. If the URL does not contain extension, then it will assume the file is PDF.