How to detect if AxAcroPdf component has loaded PDF?

1.1k views Asked by At

I have an AxAcroPdf component in my C#.Net application which loads a pdf from a url:

pdfViewer.src = previewUrl;

When there is nothing at that URL the component hangs. I have tried adding a timer which checks a boolean value which is updated after the pdf is loaded, but the AxAcroPdf component loads from a URL in a background thread which is inaccessible to me, so this approach does not work.

As far as I can tell the component does not provide any methods for checking on the progress of getting a pdf from a URL.

My final option is to download the pdf separately, then use the loadFile method instead, but I would prefer to avoid doing this if possible because the information contained in the pdf is sensitive so I would prefer not to be putting a copy of the pdf on my users PCs.

Any ideas?

Edit: The pdf is generated by a Mule service, so looking at the URL twice is not really an option either as it puts an unacceptable load on the server.

1

There are 1 answers

1
Harry On BEST ANSWER

Your application could test the URL itself for any timeouts/404's. Then if it's ok, proceed with the pdf code.