We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Some PDFs will not open in WPF PDFViewer but *will* open in UWP control

I am writing an app for a client that allows users to browse a library of local PDFs, download new ones from a corporate server and read them, print them, etc and my client wants both a WPF and a UWP version.  However I am seeing an issue in the WPF version where some PDFs are not loaded (PdfViewer_DocumentLoaded is never fired and nothing appears in the viewer control) but if I load this same PDF in the UWP version it loads with no issue.  I don't get any exceptions in the WPF version - the document just doesn't load :-(

As you can imagine this is a huge issue as the users need to be able to load all PDFs on either platform so is this a bug in the WPF version or some sort of limitation?

Just FYI, in WPF I'm just loading it like so:

        int totalPages= 0;

        private void btnCF_OpenPDF_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.DefaultExt = ".pdf";                // Default file extension
            dlg.Filter = "PDF (.pdf)|*.pdf";      // Filter files by extension
            Nullable<bool> result = dlg.ShowDialog();
            if (result == true)
            {
                pdfViewer.Load(dlg.FileName);
              }
        }

        private void PdfViewer_DocumentLoaded(object sender, EventArgs args)
        {
            totalPages = pdfViewer.PageCount();
        }

...and in UWP I do it via the StorageFile and Stream objects:

        int totalPages= 0;

        private async Task LoadPDF(StorageFile file)
        {
            var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
            Stream fileStream = stream.AsStreamForRead();
            pdfViewer.LoadDocument(fileStream);
       }

        private void dfViewer_DocumentLoaded(object sender, Syncfusion.Windows.PdfViewer.DocumentLoadedEventArgs e)
        {
            totalPages = pdfViewer.PageCount;
        }




7 Replies

SS Sathish Sivakumar Syncfusion Team May 28, 2019 06:18 AM UTC

Hi Mike, 

We tried to reproduce the issue “Some PDF documents are loaded in PdfViewerControl in WPF” with the code snippet provided in your update, but the PDF documents are loaded properly in PdfViewerControl as expected. Please find the sample in the below link with which we tried to reproduce the issue in our side. 


Kindly share the following details to analyze more on this issue. 

  1. Simple sample / modify the above sample to reproduce the issue.
  2. PDF document with which the issue could be reproduced.
  3. Essential studio version.
  4. Visual Studio version.
  5. .NET framework version.
  6. Windows OS details.

Regards, 
Sathish 



MC Mike Christie May 30, 2019 01:52 AM UTC

Hi Satish, thanks for your answer.

I've tried to answer your list of requested details below.

2. PDF document with which the issue could be reproduced.
The file is larger than your 30MB limit but it can be had from Dropbox:  https://www.dropbox.com/s/5fjn7o9d0vlw8qo/PdfViewer_Sample.zip?dl=0

3.: Essential studio version. 
I downloaded 17.1450.0.38 but upgraded my solution (via Nuget) to 17.1460.0.48 a few days ago.

Visual Studio version.
Community Version 15.9.11

.NET framework version.
WPF: v4.7.2
UWP: Target: v1803, build 17134.  Min version: Fall creators update build 16299)

Windows OS details.
Windows 10 Pro v1809 build 17763.404

The thing that I don't understand is the PDF I uploaded to dropbox will open in your UWP control, Adobe Acrobat and Foxit Reader with no issues yet will not open in the WPF version and also does not cause any exception or generate any information (as far as I know) as to why it won't load.  It does only happen with some PDFs so maybe this one is damaged but again, why will it open on many other readers and the UWP PdfViewer but not in WPF?  And if the WPf control thinks it's damaged why doesn't it throw an exception?

Thanks,

Mike








SS Sathish Sivakumar Syncfusion Team May 30, 2019 09:49 AM UTC

Hi Mike, 

Thank you for sharing the PDF document. 

We are able to reproduce the issue "PDF document is not displayed in PdfViewerControl in WPF” in our side. We have forwarded this issue to our development team for further analysis and we will update further details on 03rd June 2019.  

Regards, 
Sathish 



MC Mike Christie May 30, 2019 11:45 PM UTC

Many thanks Satish - I look forward to an update ASAP.


SS Sathish Sivakumar Syncfusion Team June 3, 2019 03:53 PM UTC

Hi Mike, 
 
Sorry for the inconvenience caused. 
 
We are still working validating the issue “Some PDF documents are not displayed in PdfViewerControl in WPF” in our side. We will update further details on this issue by tomorrow (04th June 2019). 
 
Regards, 
Sathish 
 



SS Sathish Sivakumar Syncfusion Team June 4, 2019 12:17 PM UTC

Hi Mike,

Thank you for your patience.

We have confirmed that the issue “Some PDF documents are not displayed in PdfViewerControl in WPF” is defect and logged defect report for this issue. The patch for this issue will be delivered on 18-June-2019.

Regards,
Sathish




SS Sathish Sivakumar Syncfusion Team June 18, 2019 03:39 PM UTC

Hi Mike,

The issue with "PDF document is not displayed in PdfViewerControl in WPF" has been fixed and the patch for this fix can be downloaded from the following location.

Recommended approach - exe will perform automatic configuration
Please find the patch setup from below location:
http://syncfusion.com/Installs/support/patch/17.1.0.47/82404/F144893/SyncfusionPatch_17.1.0.47_82404_6182019100204974_F144893.exe

Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment
Please find the patch assemblies alone from below location:
http://syncfusion.com/Installs/support/patch/17.1.0.47/82404/F144893/SyncfusionPatch_17.1.0.47_82404_6182019100204974_F144893.zip
 
Nuget: 

Assembly Version: 17.1.0.47
Installation Directions :
This patch should replace the files “Syncfusion.Pdf.Base,Syncfusion.PdfViewer.WPF” under the following folder.
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\4.7.2
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\9.3.0.61\precompiledassemblies\9.3.0.61\4.0

To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you will have to manually copy and paste them to the preferred location or you will have to run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.

Note :
You can change how you receive bug fixes by navigating to the following link and updating your preferences.

https://www.syncfusion.com/support/directtrac/patches

Disclaimer :
Please note that we have created this patch for version 17.1.0.47 specifically to resolve the following issue(s) reported in this/the incident(s). 239042

If you have received other patches for the same version for other products, please apply all patches in the order received.
This fix will be included in our main release 2019 Volume 2 which will be available in June 2019.

Regards,
Sathish


Loader.
Live Chat Icon For mobile
Up arrow icon