PDF Viewer print exception Wrong Block Length

Hi Support,
We intermittently we are seeing this exception when trying to open the print dialog like this:
 Dim viewer = New PdfViewerControl()
  viewer.ReferencePath = $"{AppDomain.CurrentDomain.BaseDirectory}\BuildTools\"
  viewer.RenderingEngine = PdfRenderingEngine.Pdfium

  viewer.Load(path)
  viewer.print(True)

Sometimes we see this error:

Message: Wrong block length.
Stack trace: at Syncfusion.Compression.CompressedStreamReader.DecodeBlockHeader()
at Syncfusion.Compression.CompressedStreamReader..ctor(Stream stream, Boolean bNoWrap)
at Syncfusion.Pdf.Compression.PdfZlibCompressor.Decompress(Stream inputStream)
at Syncfusion.Pdf.Compression.PdfZlibCompressor.Decompress(Byte[] data)
at Syncfusion.Pdf.Primitives.PdfStream.Decompress(Byte[] data, String filter)
at Syncfusion.Pdf.Primitives.PdfStream.Decompress()
at Syncfusion.Windows.PdfViewer.PrintPage..ctor(PdfPageBase page)
at Syncfusion.Windows.PdfViewer.DocumentView.LoadPrintPages()
at Syncfusion.Windows.PdfViewer.DocumentView.get_PrintingDocument()
at Syncfusion.Windows.PdfViewer.DocumentToolbar.Print()
at Syncfusion.Windows.PdfViewer.PdfViewerControl.Print(Boolean showPrintDialog)

Unfortunately I cannot share the PDF file for security reasons, but I may be able to find out more information about it.

Thank you


3 Replies 1 reply marked as answer

DD Divya Dhayalan Syncfusion Team June 3, 2021 01:49 PM UTC

Hi Scott, 
 
We tried to reproduce the reported issue “Exception thrown while Printing with WPF PdfViewer” in our side with the documents we have. But we are not able to reproduce the issue in our end. Based on the stack trace details you have provided we suspect may the issue is due to the dependent dll “Syncfusion.Compression.Base” is missing to add in the reference. So, kindly add the “Syncfusion.Compression.Base” to the reference folder and check the issue solved. 
 
Please find the below link to know more about the dependent dlls of the “Syncfusion.PdfViewer.WPF” dll. 
https://help.syncfusion.com/wpf/control-dependencies#pdfviewer 
  
We also created a sample for your reference which can be downloaded from the below link,  
  
We request you to print the documents which created issue with the above sample and inform us if the issue reproduced or not. Since the issue is not reproduced with our documents and based on the stack trace details, you have mentioned we suspect this issue might be specific to document. So kindly share any mock document to reproduce the issue and provide you a better solution. 
 
Regards, 
Divya 


Marked as answer

SB Scott Barber June 4, 2021 03:11 AM UTC

Hi Divya,
We are referencing Syncfusion.Compression.Base.

I will see if I can reproduce with the provided sample.

Thanks,
Scott


DD Divya Dhayalan Syncfusion Team June 7, 2021 09:27 AM UTC

Hi Scott, 
 
Thank you for the update, 
 
We will wait until any updates from you about the testing results with the sample. 
 
Regards, 
Divya 


Loader.
Up arrow icon