PDF Viewer print is thrrowing null reference exception

11 posts, 0 answers
  1. Parthasarathy
    Parthasarathy avatar
    2 posts
    Member since:
    Jul 2011

    Posted 10 Jul 2013 Link to this post

    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.
  2. Kammen
    Admin
    Kammen avatar
    312 posts

    Posted 15 Jul 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Rouven
    Rouven avatar
    9 posts
    Member since:
    May 2011

    Posted 17 Jul 2013 Link to this post

    -double post-
  5. Rouven
    Rouven avatar
    9 posts
    Member since:
    May 2011

    Posted 17 Jul 2013 Link to this post

    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
  6. Alexander
    Admin
    Alexander avatar
    41 posts

    Posted 19 Jul 2013 Link to this post

    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 >>
  7. Rouven
    Rouven avatar
    9 posts
    Member since:
    May 2011

    Posted 22 Jul 2013 Link to this post

    Thanks that works great.
  8. Kedar
    Kedar avatar
    15 posts
    Member since:
    Jun 2012

    Posted 29 Jul 2013 Link to this post

    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.
     
  9. Vasil
    Admin
    Vasil avatar
    124 posts

    Posted 31 Jul 2013 Link to this post

    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 >>
  10. Kedar
    Kedar avatar
    15 posts
    Member since:
    Jun 2012

    Posted 12 Aug 2013 Link to this post

    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

  11. Vasil
    Admin
    Vasil avatar
    124 posts

    Posted 14 Aug 2013 Link to this post

    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 >>
  12. Kedar
    Kedar avatar
    15 posts
    Member since:
    Jun 2012

    Posted 17 Aug 2013 Link to this post

    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.
Back to Top
UI for WPF is Visual Studio 2017 Ready