This is a migrated thread and some comments may be shown as answers.

PDF Viewer print is thrrowing null reference exception

10 Answers 297 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Parthasarathy
Top achievements
Rank 1
Parthasarathy asked on 10 Jul 2013, 09:36 AM
We are using PDF Viewer print functionality to print the document. It was working but some times later, it is throwing "Null Reference Exception"

Version Details: 2012.3.1129.40

Exception Stack trace:

Object Reference not set to an object

at Microsoft.Internal.GDIExporter.CopyTo(UInt16& buffer, Int32 len, String s)

   at Microsoft.Internal.GDIExporter.CGDIRenderTarget.CreateFontW(GlyphRun pGlyphRun, Double fontSize, Double scaleY)

   at Microsoft.Internal.GDIExporter.CGDIRenderTarget.RenderTextThroughGDI(GlyphRun pGlyphRun, Brush pBrush)

   at Microsoft.Internal.GDIExporter.CGDIRenderTarget.DrawGlyphRun(Brush pBrush, GlyphRun glyphRun)

   at Microsoft.Internal.AlphaFlattener.BrushProxyDecomposer.Microsoft.Internal.AlphaFlattener.IProxyDrawingContext.DrawGlyphs(GlyphRun glyphrun, Geometry clip, Matrix trans, BrushProxy foreground)

   at Microsoft.Internal.AlphaFlattener.PrimitiveRenderer.DrawGlyphs(GlyphRun glyphrun, Rect bounds, Matrix trans, String desp)

   at Microsoft.Internal.AlphaFlattener.Flattener.AlphaRender(Primitive primitive, List`1 overlapping, Int32 overlapHasTransparency, Boolean disjoint, String desp)

   at Microsoft.Internal.AlphaFlattener.Flattener.AlphaFlatten(IProxyDrawingContext dc, Boolean disjoint)

   at Microsoft.Internal.AlphaFlattener.Flattener.Convert(Primitive tree, ILegacyDevice dc, Double width, Double height, Double dpix, Double dpiy, Nullable`1 quality)

   at Microsoft.Internal.AlphaFlattener.MetroDevice0.FlushPage(ILegacyDevice sink, Double width, Double height, Nullable`1 outputQuality)

   at Microsoft.Internal.AlphaFlattener.MetroToGdiConverter.FlushPage()

   at System.Windows.Xps.Serialization.NgcSerializationManager.EndPage()

   at System.Windows.Xps.Serialization.NgcDocumentPageSerializer.SerializeObject(Object serializedObject)

   at System.Windows.Xps.Serialization.NgcDocumentPaginatorSerializer.SerializeObject(Object serializedObject)

   at System.Windows.Xps.Serialization.NgcSerializationManager.SaveAsXaml(Object serializedObject)

   at System.Windows.Xps.XpsDocumentWriter.SaveAsXaml(Object serializedObject, Boolean isSync)

   at System.Windows.Xps.XpsDocumentWriter.Write(DocumentPaginator documentPaginator)

   at System.Windows.Controls.PrintDialog.PrintDocument(DocumentPaginator documentPaginator, String description)

   at Telerik.Windows.Documents.Fixed.Print.PrintManager.Print(PrintSettings settings)

   at Telerik.Windows.Controls.FixedDocumentViewerBase.Print(PrintSettings settings)

   at Telerik.Windows.Controls.FixedDocumentViewerBase.Print()



Let me know how to resolve this issue. and also the pdf document is of 70 Kb but while printing through PDF Viewer it sends 700 kb file to printer.

10 Answers, 1 is accepted

Sort by
0
Kammen
Telerik team
answered on 15 Jul 2013, 08:06 AM
Hello,

We will really appreciate if you can send us sample project that reproduces this issue in order to investigate it.

As for the size of the printed document - the size of the print document is not related to the size of the PDF file. There are some algorithms that reduce the PDF file's size; however, they cannot be used when the document is printed.

Regards,
Kammen
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Rouven
Top achievements
Rank 1
answered on 17 Jul 2013, 06:03 AM
-double post-
0
Rouven
Top achievements
Rank 1
answered on 17 Jul 2013, 06:04 AM
Hello,
i've got the same problem with version 2013.2.611.40.

Here is my sample project:
http://theupload.de/archive/PdfPrintTest.zip

Thanks
0
Alexander
Telerik team
answered on 19 Jul 2013, 01:45 PM
Hi Rouven,

You can read this article which describes how to use RadPdfViewer in non-WPF applications.

Additionally, the loading of the document is asynchronous when you set the DocumentSource of RadPdfViewer. In order to load it synchronously, you need to directly set the Document property using PdfFormatProvider as you did in your project.
I'm attaching a sample project which shows how to print a document in a console application.

I hope this is helpful. Please, do not hesitate to contact us if you have any other questions.

Regards,
Alexander
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Rouven
Top achievements
Rank 1
answered on 22 Jul 2013, 06:54 AM
Thanks that works great.
0
Kedar
Top achievements
Rank 1
answered on 29 Jul 2013, 09:50 AM
Hi Telerik Team,

Your sample is failing on following system environment. Can you let me know if I am missing anything.

Machine Operating System = Win32NT, Microsoft Windows NT 6.1.7601 Service Pack 1
Machine Operating system Service pack = Service Pack 1
Machine Processor Count = 2
Is64BitOperatingSystem : False 

thanks,
Kedar.
 
0
Vasil
Telerik team
answered on 31 Jul 2013, 11:53 AM
Hello Kedar,

We have tested our application against the described setup and it has printed the document successfully.

Could you please elaborate a little bit more on the error (exception type, inner exception type, stack trace) you are receiving as well as what version of RadControls for WPF you are using? It would be great if you could record a short video demonstrating the problem and send it back to us along with a sample project if you did some modifications to ours.

Looking forward to your response.

Regards,
Vasil
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Kedar
Top achievements
Rank 1
answered on 12 Aug 2013, 10:29 AM

Hi ,

could you share your test application.

Following is the exception we are getting.

Exception Stack trace:

Object Reference not set to an object

at Microsoft.Internal.GDIExporter.CopyTo(UInt16& buffer, Int32 len, String s)

   at Microsoft.Internal.GDIExporter.CGDIRenderTarget.CreateFontW(GlyphRun pGlyphRun, Double fontSize, Double scaleY)

   at Microsoft.Internal.GDIExporter.CGDIRenderTarget.RenderTextThroughGDI(GlyphRun pGlyphRun, Brush pBrush)

   at Microsoft.Internal.GDIExporter.CGDIRenderTarget.DrawGlyphRun(Brush pBrush, GlyphRun glyphRun)

   at Microsoft.Internal.AlphaFlattener.BrushProxyDecomposer.Microsoft.Internal.AlphaFlattener.IProxyDrawingContext.DrawGlyphs(GlyphRun glyphrun, Geometry clip, Matrix trans, BrushProxy foreground)

   at Microsoft.Internal.AlphaFlattener.PrimitiveRenderer.DrawGlyphs(GlyphRun glyphrun, Rect bounds, Matrix trans, String desp)

   at Microsoft.Internal.AlphaFlattener.Flattener.AlphaRender(Primitive primitive, List`1 overlapping, Int32 overlapHasTransparency, Boolean disjoint, String desp)

   at Microsoft.Internal.AlphaFlattener.Flattener.AlphaFlatten(IProxyDrawingContext dc, Boolean disjoint)

   at Microsoft.Internal.AlphaFlattener.Flattener.Convert(Primitive tree, ILegacyDevice dc, Double width, Double height, Double dpix, Double dpiy, Nullable`1 quality)

   at Microsoft.Internal.AlphaFlattener.MetroDevice0.FlushPage(ILegacyDevice sink, Double width, Double height, Nullable`1 outputQuality)

   at Microsoft.Internal.AlphaFlattener.MetroToGdiConverter.FlushPage()

   at System.Windows.Xps.Serialization.NgcSerializationManager.EndPage()

   at System.Windows.Xps.Serialization.NgcDocumentPageSerializer.SerializeObject(Object serializedObject)

   at System.Windows.Xps.Serialization.NgcDocumentPaginatorSerializer.SerializeObject(Object serializedObject)

   at System.Windows.Xps.Serialization.NgcSerializationManager.SaveAsXaml(Object serializedObject)

   at System.Windows.Xps.XpsDocumentWriter.SaveAsXaml(Object serializedObject, Boolean isSync)

   at System.Windows.Xps.XpsDocumentWriter.Write(DocumentPaginator documentPaginator)

   at System.Windows.Controls.PrintDialog.PrintDocument(DocumentPaginator documentPaginator, String description)

   at Telerik.Windows.Documents.Fixed.Print.PrintManager.Print(PrintSettings settings)

   at Telerik.Windows.Controls.FixedDocumentViewerBase.Print(PrintSettings settings)

   at Telerik.Windows.Controls.FixedDocumentViewerBase.Print()


thanks,
Kedar

0
Vasil
Telerik team
answered on 14 Aug 2013, 03:35 PM
Hi Kedar,

The application we are using for testing is the project previously attached here by my colleague Alexander.

Unfortunately, we are still unable to reproduce this problem. I am afraid that without further information such as: exact steps to reproduce, exception type, inner exception type, stack trace as well as what version of RadControls for WPF you are using; we are unable to provide you with any assistance on this matter. It would also be great if you could record a short video demonstrating the problem and send it back to us along with a sample project if you did some modifications to ours.

Thank you in advance for your cooperation.

Regards,
Vasil
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Kedar
Top achievements
Rank 1
answered on 17 Aug 2013, 05:40 AM
Hi Telerik Team,

I have attached the snap shot that shows the dll's version that I am using. Can you let me know if my issue is due to the version of the telerik dll's?

thanks,
Kedar.
Tags
PDFViewer
Asked by
Parthasarathy
Top achievements
Rank 1
Answers by
Kammen
Telerik team
Rouven
Top achievements
Rank 1
Alexander
Telerik team
Kedar
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or