Thanks for the work.
Using the same SQL CLR, same C# class etc that I gave to you yesterday. I noticed two more issues, details below. And the same .one document can be converted fine in Console app.
I have attached my sample .one file for you to reproduce the error. You need to change the file name in the testing scripts below , ( already changed to sarah_2 here)
Declare @OneNote_FilePath nvarchar(2000)
Declare @PDF_New_FilePath nvarchar(2000)
set @OneNote_FilePath = ‘\DEVSHRPNTSQL01\G$\Sarah_test\Sarah_2.one’;
set @PDF_New_FilePath = ‘\DEVSHRPNTSQL01\G$\Sarah_test\Sarah_2_out.pdf’;
select [OneNote].[dbo].[convert_onenote_to_PDF] (@OneNote_FilePath, @PDF_New_FilePath)
– (Issue 1)
when converting a .one document with pics , generate error below, but when run in console app, no issues. once the pic is taken off the file, the SQL CLR runs fine. So it seems to me something is missing to load/read/convert the pic ?
Msg 6522, Level 16, State 2, Line 72
A .NET Framework error occurred during execution of user-defined routine or aggregate “convert_onenote_to_PDF”:
System.IO.FileNotFoundException: Could not load file or assembly ‘zx_30c9d1d6785e41c382999a806199e059, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at ..()
at .(Object , ResolveEventArgs )
at System.AppDomain.OnResourceResolveEvent(RuntimeAssembly assembly, String resourceName)
at System.Reflection.RuntimeAssembly.GetResource(RuntimeAssembly assembly, String resourceName, UInt64& length, StackCrawlMarkHandle stackMark, Boolean skipSecurityCheck)
at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name, StackCrawlMark& stackMark, Boolean skipSecurityCheck)
at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name)
at .(String )
at .()
at . ( )
at .(SortedList , )
at .( )
at . ( )
at . …
– issue (2)
when using SQL CLR to convert a .one document with multiple pages, no errors but only converted the first page. but when run in console app, no issues, able to convert multiple pages, sub pages and pics nicely.