NullReferenceException on MergeDocument constructor

NullReferenceException on MergeDocument constructor

Forum member · Jul 19, 2023
Hello. The following is throwing a NullReferenceException on the "var doc = ..." line. Assume dbAccessKey is a valid license key, srcfile is the full path to the source file, and outfile is a valid full path to the output file. ------ var dbAccessKey = "[key]"; var srcfile = "[sourceFileFullPath]"; var outfile = "[outFileFullPath]"; if (ceTe.DynamicPDF.Document.AddLicense(dbAccessKey)) { var doc = new ceTe.DynamicPDF.Merger.MergeDocument(srcfile) { CompressionLevel = 9 }; // THROWS ON THIS LINE doc.Draw(outfile); } ------ DynamicPDF.CoreSuite 12.6.0.49301 System.NullReferenceException (Object reference not set to an instance of an object.) at #Lae.#aee.#6de(#Zje #dh, Int32 #7de, #Wde #NBb, Int32 #3de) at #Lae.#aee.#1de(#Wde #NBb, #4me #2de, Int32 #3de) at #Lae.#aee.#4de() at #6lc.#owc.#ewc(#Zje #dh, Int32 #fwc, Int32 #gwc) at #Lae.#Kde.#p0c(Int32 #fwc, Int32 #gwc) at ceTe.DynamicPDF.Merger.MergeDocument.#ng(PdfDocument #qde, #Kde #rde) at [USER_CODE] ----- Any advice would be helpful. I can provide the source PDF upon request. Thank you. -Brad

Re: NullReferenceException on MergeDocument constructor

Support · Jul 19, 2023
Hi, Please send over following information to [^a|mailto:support@dynamicpdf.com|opennewwindow|support@dynamicpdf.com^] so we can look into it further. 1. Code sample which uses static data to recreate the error. 2. Full error message along with stack trace. 3. Source files used for merging(to recreate error). 4. Exact version and build number of the DynamicPDF DLL file used in your application. You can find this information by right clicking on the DLL file>>Properties>>Details tab>>Product version. Take a screenshot of the Details tab and send it over to us. Thanks, ceTe Software Support Team