GcPdfDocument Save method exception

Posted by: alexandre.lefebvre on 26 September 2019, 2:52 am EST

  • Posted 26 September 2019, 2:52 am EST

    I'm using GcPdfDocument class to merge a couple of PDF documents and save the result. I'm getting the following exception on save.

    System.NullReferenceException: Object reference not set to an instance of an object.
    at zc.d(PdfRef A_0)
    at zc.d(String A_0, Object A_1)
    at zc.d(PdfDict A_0, String[] A_1)
    at zc.d(yz A_0, Boolean A_1, EncryptionStreamType A_2, Boolean A_3)
    at acj.Write(zc w)
    at GrapeCity.Documents.Pdf.Writer.PdfIndirectSerializableObject.GrapeCity.Documents.Pdf.Writer.IPdfIndirectSerializableObject.Write(zc w)
    at zc.jb(ze A_0)
    at zc.h(ze A_0)
    at abz.c.m8(GcPdfDocument A_0, Action`1 A_1)
    at abz.EnumerateNestedObjects(GcPdfDocument doc, Action`1 callback)
    at GrapeCity.Documents.Pdf.Writer.PdfIndirectSerializableObject.GrapeCity.Documents.Pdf.Writer.IPdfIndirectSerializableObject.EnumerateNestedObjects(GcPdfDocument doc, Action`1 callback)
    at zc.jb(ze A_0)
    at zc.h(ze A_0)
    at GrapeCity.Documents.Pdf.Page.EnumerateNestedObjects(GcPdfDocument doc, Action`1 callback)
    at GrapeCity.Documents.Pdf.Writer.PdfIndirectSerializableObject.GrapeCity.Documents.Pdf.Writer.IPdfIndirectSerializableObject.EnumerateNestedObjects(GcPdfDocument doc, Action`1 callback)
    at zc.jb(ze A_0)
    at zc.h(ze A_0)
    at GrapeCity.Documents.Pdf.PageCollection.a(GcPdfDocument A_0, Action`1 A_1)
    at GrapeCity.Documents.Pdf.PageCollection.GrapeCity.Documents.Pdf.Writer.IPdfIndirectSerializableObject.EnumerateNestedObjects(GcPdfDocument doc, Action`1 callback)
    at zc.jb(ze A_0)
    at GrapeCity.Documents.Pdf.GcPdfDocument.c()
    at GrapeCity.Documents.Pdf.GcPdfDocument.a(SignatureProperties A_0, Stream A_1, Boolean A_2)
    at GrapeCity.Documents.Pdf.GcPdfDocument.Save(Stream stream, Boolean incrementalUpdate)
  • Marked as Answer

    Replied 26 September 2019, 9:32 pm EST

    Hello,

    Please refer the sample to merge PDF documents at the following link:
    http://demos.componentone.com/gcdocs/gcpdf/Samples/List/MergePDFs/codeCS

    You may add your documents to the sample's Resources>PDFs location and see if the issue persists.
    As the mentioned exception may be caused due to various reasons, could you please share your PDF documents, along with your code snippet so that we can test the same at our end? We hope that you are using the latest NuGet package (2.2.0.316): https://www.nuget.org/packages/GrapeCity.Documents.Pdf/.
    In case you wish to share the files over a private platform, you can create a ticket on SupportOne: https://supportone.componentone.com

    Regards,
    Esha
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels