Pdf Save Options Null Reference when calling dg.GenerateDocument

0
mflerin posted this 06 December 2014

Hi,

I can use SaveOptions.Word without any problems but when I try SaveOptions.Pdf I get an null reference exception.

I'm referencing the Docentric.Pdf dll.

Any help would be appreciated.

Here's the code:

      using (var templateStream = assembly.GetManifestResourceStream("mf.Docs.EnquirySheet.docx"))
        {
            var dg = new DocumentGenerator(docData);
            var result = dg.GenerateDocument(templateStream, outputDocumentStream,SaveOptions.Pdf);

            if (result.HasErrors)
            {
               throw new Exception(result.Errors.First().Message);
            }

            outputDocumentStream.Position = 0;
        }

3 Posts
3 Points
8 Comments
Order By: Standard | Newest | Votes
0
jles posted this 08 December 2014

Hi,

Thanks for reporting the issue. Could you please show the stack trace. And if possible, could you also output the document to docx and send it to us. I suspect that there is an issue with the PDF renderer and this way it will be very easy for us to reproduce the issue on our side.

Thanks, Jure Leskovec

155 Posts
295 Points
0
mflerin posted this 15 March 2015

Hi

Really hope you can help as I could really do with the PDF output working.

Couldn't attach the document so emailed it to your info@ email address

Here is the stack trace:

at Docentric.Documents.ObjectModel.CompositeFormatPropertyObject.#=qaPtWeGriyDkv2hYrnw8RFw==(Type #=qZywDxNlaLwelWjs3QMwIZA==, Type #=qdwWVvIMLjLpGXeGMHd8IzHMxjYMZB$liXQJBZiJ97ZmcespeLrPqRd86tbh9QK, DocumentObject #=qSYMF3FdCKOdjd0CIx1zOOw==, CharacterFormatResolveMode #=qNYRnuI10O0kx7RIXQlaPq3kXYFU$fieDUuAcwqem$g=) at Docentric.Documents.ObjectModel.Format.#=qjc6n6$ruSdFS5qDZaWRgLg==[FRMT](DocumentObject #=qZtf6TL1EMOTY$aIY07qWA==, CharacterFormatResolveMode #=q2VnnxnMIosXrMQtgRTZ9J5BrpNGNzKIlE7XkXYatsc=) at #=qAbNGtC8fVGBBjWwMMUpHCK5rTe$4iwEowqkddrCuCG4pcxVFfaZStWJsv6NgSIPEH1XbjIxOwAHLq4kaCS3Dw==.#=qyR1ZqV0HoNNOvdDdFPjOe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a$bQ==.#=qGDHtKUEmVJ47tHFykPZ3kTkXEP5dYodung28vMnoX$c=(Section #=q6eUCEqeyfsIM8gYQ$J_m4g==, Int32 #=qB7Y_ArcRAUgnzbVMC7r9To2tLoFVmaq97pDfA4XRHLY=) at #=qJcx5xDM70eNYIiMrmtOiH9XOWDik6xBQW0Jto_D7aghVYi7MZg4$HDBI6y6SplbZl$oM9TUjnHsBzddjXKhGvA==.#=q5UOeOb70UTSDWl9UTw$4N9B_vvNoMuhNFq8PtWnNGZY=(Section #=qxgI_3De2LYoo2DEi4LfIfA==, Int32 #=qOo_411Hy4Vsc4xl8$cv7Odr20yjG3SauWQv3h$vujnQ=) at #=qWn4xFTncNcrVbCzDQxGrtYf3aCSJoUTcZzclqtQUOpF0WWuf9r1njBNdcRY3ImkM7IeeOx8QNQcNbYS1ZYYCf7DPHzJ4OSLG6UhidQphQWU=.#=qyZC13RobyYuwU4TKwpdOcfTEYof36Nc8$WyOSCTWeJA=(Section #=qVUOguc3uwB7_k6wkRkFkiw==, Int32 #=qbrM59hihaXkwAbIbU6a91wKAhHiUUdqMkFK_iLsOYEk=) at #=qiIY$FW0AH8smGMTiwfOcLbjBUtQ7i6SjDP0$xGvuXvpBaf7W2a_ljL1JnTEdCfOAsb4Xvh2tGWVXJXrqS9rxAw==.#=qu_VjeepU0O6lu$jGvqc9CA==(Section #=qonjty$TXTqrL6hhZL3Q6EQ==) at #=qiIY$FW0AH8smGMTiwfOcLbjBUtQ7i6SjDP0$xGvuXvpBaf7W2a_ljL1JnTEdCfOAsb4Xvh2tGWVXJXrqS9rxAw==.#=qyVfkILvqE0TspMxlhTnRXA==() at Docentric.Documents.ObjectModel.Document.#=qvy9VP17nHqP2xYWEwTToXx73imLbciFNI7b6hgS_6Pk=() at Docentric.Documents.ObjectModel.Document.Save(Stream stream, SaveOptions savingOptions) at Docentric.Documents.Reporting.DocumentGenerator.#=qpJW2aVjA4Xi0HvfHhJXSwyntOfNztrcTZrc$zun5zKQ=(SaveOptions #=qrCNK1DXumSfkLt$bBxiptg==, Stream #=q551ln3BUVipT4aovRq1a031VVaF7UMw2gt2rF1IBqiQ=) at Docentric.Documents.Reporting.DocumentGenerator.GenerateDocument(Stream templateStream, Stream outputDocumentStream, SaveOptions saveOptions) at mf.Docs.DocentricService.EnquirySummary(Guid tenantId, DocData docData) in C:\dev\surveyhub\mf\Documents\mf.Docs\DocentricService.cs:line 35 at mf.Web.Controllers.DocumentController.Enquiry(Guid id) in C:\dev\surveyhub\mf\mf.Web\Controllers\DocumentController.cs:line 59 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<begininvokesynchronousactionmethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>cDisplayClass46.b__3f()

Last edited 15 March 2015

3 Posts
3 Points
0
jles posted this 15 March 2015

Hi Marc,

Pagination and PDF output have been greatly improved since you started this forum thread. What version of DT are you using?

Regards, Jure

155 Posts
295 Points
0
mflerin posted this 15 March 2015

Hi Jure,

Just updated to the latest version of the dll's 2.1.3.920 and everything works as it should.

Thanks for your quick response.

Marc.

3 Posts
3 Points
0
jles posted this 15 March 2015

Great! Just know that we are about to release (in 1 week) version 2.2 that will be have PDF output improved even further and besides it will bring support for shapes.

Cheers, Jure

155 Posts
295 Points
0
fgeldenh posted this 25 April 2015

Hi - I now have that problem with the latest release. See stack trace below.

[ArgumentNullException: Value cannot be null. Parameter name: key] System.Collections.Generic.Dictionary2.FindEntry(TKey key) +10757081 System.Collections.Generic.Dictionary2.TryGetValue(TKey key, TValue& value) +12 #=qI4E$NCwcAa7pyVXI384JpBLrOuug6KNKFvRtqDEEK81kwUJRyV3RphYYX1HaWZNfXYw2ZxDIaoB8SYIDSvx7w==.#=qiaj$BWsTstOnqQKEnDOuXYcIdozTc$1r2ck0xYc3rhI=(Paragraph #=qSoKjNtkHh15L2EEiCWK9QQ==) +69 #=qmu6EhVjt5fWPvwYYFd8LWF5E94aNpBXD3cQRN8hEfJ8NR3wlOclsAyBKOf5kJM$y$ytYIH1k5kqm$v0E4q7A==.#=qBR7Kmvn8ktAGg9F3$7cdR5F2mD5i5hOG2HpNiveeOzOXoHCvmrZ$hSLeCtCfRuBb(Int32 #=qWvbFTItN$ovdNHLj$2Cww==) +154 #=qmu6EhVjt5fWPvwYYFd8LWF5E94aNpBXD3cQRN8hEfJ8NR3wlOclsAyBKOf5kJM$y$ytYIH1k5kqm$v0E4q7A==.#=qOXaOhxiinDXPAcw84LbmLO$f28Vk2rTQ16wjSVpqY0k=() +4029 #=qmu6EhVjt5fWPvwYYFd8LWF5E94aNpBXD3cQRN8hEfJ8NR3wlOclsAyBKOf5kJM$y$ytYIH1k5kqm$v0E4q7A==.#=qMi7NrIva3qZHFhu68Z45A==() +212 #=qmu6EhVjt5fWPvwYYFd8LWF5E94aNpBXD3cQRN8hEfJ8NR3wlOclsAyBKOf5kJM$y$ytYIH1k5kqm$v0E4q7A==.#=qweDkOHUlh9uinyIbHF1SDw==() +49 #=qTb1or0e66bdTFsYKIRoWNB$xxT7xAvlvwDlw0yOKUsPzfFs149XIH7uubnLWB39AUgrbhxZcne3LQznwL6qlHw==.#=qsktjWZ$FXLeK3bUbgiCsOPIZUqI9tgBycVJG3i1r52Q=(Story #=qdOhX9lQkJNOOvW$Xz2jvg==, #=q_fakqWeq6JEQYUcdoSnV10I5AkRjPenIpqHw5FNBr8AbjDnvwt9O7uAhBIMZF4gxEkdgJspAWppYrQ$voItODQ== #=qRPyk8OoN5iyAWfyGU3C5vA==, Dictionary2 #=q3KbnS6GmEFMPG5fr7_DQ9bgwEvGLoM2DSGcVVNSThjlPmIk4YYiRT4fW6kv55mNU, #=qs40wGgLFe_kB2raeL4GTKdBmKcxraFFV2JffjTM46IxliJ8IEm6e6SMqzLKzN5_InQ8$hDuIRNZyGf_Q6Il3Bw== #=qTPu2phDb6s67cNtyJ_6qHQ==) +737 #=qTb1or0e66bdTFsYKIRoWNB$xxT7xAvlvwDlw0yOKUsPzfFs149XIH7uubnLWB39AUgrbhxZcne3LQznwL6qlHw==.#=qBGEGShsxwIzfKqPVVWSvFA==() +858 Docentric.Documents.ObjectModel.Document.#=q7fleYvDyKmWIwlPFM6snaTSxRUFipGA6cW0sK4URdb4=() +106 Docentric.Documents.ObjectModel.Document.Save(Stream stream, SaveOptions savingOptions) +57 Docentric.Documents.Reporting.DocumentGenerator.#=qQLiJzGFaIe108HVt_Pl$MAff1xx2WEV8ur0cWhIm0hE=(SaveOptions #=qm7FkRoXwc$IKln9kXYL3IA==, Stream #=qWcK54Lec_gP7V9Ff9D1RQxXohb__2gRba9UIvLAkIHE=) +126 Docentric.Documents.Reporting.DocumentGenerator.GenerateDocument(String templateFilePath, String outputDocumentFilePath, SaveOptions saveOptions) +245 BeSecureWebsite.Controllers.<registers2async>d__ca.MoveNext() in d:\My Documents\Git\Repos\BeSecureMVC\BeSecureWebsite\BeSecureWebsite\Controllers\SiteEntityController.cs:953 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52 System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21 System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task) +61 System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +114 System.Web.Mvc.Async.<>c__DisplayClass37.<begininvokeasynchronousactionmethod>b__36(IAsyncResult asyncResult) +66 System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +47 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +136 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49 System.Web.Mvc.Async.AsyncInvocationWithFilters.<invokeactionmethodfilterasynchronouslyrecursive>b__3d() +117 System.Web.Mvc.Async.<>c__DisplayClass46.<invokeactionmethodfilterasynchronouslyrecursive>b__3f() +323 System.Web.Mvc.Async.<>c__DisplayClass33.<begininvokeactionmethodwithfilters>b__32(IAsyncResult asyncResult) +44 System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +47 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +136 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50 System.Web.Mvc.Async.<>c__DisplayClass2b.<begininvokeaction>b__1c() +72 System.Web.Mvc.Async.<>c__DisplayClass21.<begininvokeaction>b__1e(IAsyncResult asyncResult) +185 System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +133 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40 System.Web.Mvc.Controller.<beginexecutecore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +70 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +139 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44 System.Web.Mvc.Controller.<beginexecute>b__15(IAsyncResult asyncResult, Controller controller) +39 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +62 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +139 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39 System.Web.Mvc.MvcHandler.<beginprocessrequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +70 System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9651796 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

1 Posts
1 Points
0
jles posted this 25 April 2015

Hi,

Could you please tell me which version of Docentric Toolkit are you using?

Thanks, Jure Leskovec

155 Posts
295 Points
0
jles posted this 27 April 2015

Hi,

Could you please download the latest version 2.2.2 and check if removes your issue?

Thanks, Jure Leskovec

155 Posts
295 Points

Our 229041 members have posted 345 times in 102 discussions