Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
How to get quickpdf to work on azure? |
Post Reply ![]() |
Author | |
geauxOnAndOn ![]() Beginner ![]() Joined: 11 Oct 21 Location: Georgia Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() Posted: 12 Oct 21 at 2:23PM |
i guess i gotta be my own brainiac and fortune smiled upon me after I paid the pain price of trial and error.
The problem was with loadLibrary. I changed the declaration to this. [DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)] internal static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string lpFileName); changed the dll constructor to this dllHandle = LoadLibrary(dllFileName); if (dllHandle == IntPtr.Zero) { var error = Marshal.GetLastWin32Error(); } else { last error returned 126 which means it could not find the dll I passed in. this solved the problem var full = Path.GetFullPath(dllName64); var pdfLib = new PDFLibrary(full); Seems on my local machine kernel32 had no problem resolving a relative path but the azure server could not. So I sent loadLibrary the full path to the debenu dll and it worked. Onward to the next coding disaster, this one is history. |
|
![]() |
|
geauxOnAndOn ![]() Beginner ![]() Joined: 11 Oct 21 Location: Georgia Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
I have successfully gotten both the dll and the activeX to work on my local machine. However when I push to azure a totally dismal story. The dll will load but will not unlock. The activeX will not create comObject.
My environment is Azure Web App, Core 5 and I am developing using the Code editor. It is a development instance but not B1 plan, not shared, 64 bit. The key is a trial key. This is the entries I included in the the csproj. I confirmed azure deployment includes them in the root with the other compiled dlls and I have even confirmed they are accessible by loading them into memory. <ItemGroup> <None Update="DebenuPDFLibrary64DLL1811.dll"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> <None Update="DebenuPDFLibraryDLL1811.dll"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> <None Update="DebenuPDFLibrary64AX1811.dll"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> <None Update="DebenuPDFLibraryAX1811.dll"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> </ItemGroup> This is code I use with the dll that works fine locally. On azure it will create an object but instanceId is 0 and of course it will not unlock. public static string pdfKey = "br549"; public static PDFLibrary newPdfLib() { var pdfLib = new PDFLibrary("./DebenuPDFLibrary64DLL1811.dll"); var result = pdfLib.UnlockKey(pdfKey); return pdfLib; } public static void closePdfLib(PDFLibrary pdfLib) { pdfLib.ReleaseLibrary(); } This is code I am using for ActiveX which doesn't create a new object of the class. public class PDFLibraryAx { private object comObject; private Type comType; public static string pdfKey = "br549"; public static bool unlocked = false; public static int renderer = 0; public static string error = ""; public PDFLibraryAx() { try { comType = null; if (IntPtr.Size == 4) { comType = Type.GetTypeFromProgID("DebenuPDFLibraryAX1811.PDFLibrary"); } if (IntPtr.Size == 8) { comType = Type.GetTypeFromProgID("DebenuPDFLibrary64AX1811.PDFLibrary"); } if (comType != null) { comObject = Activator.CreateInstance(comType); } else { error = "comType is null"; } } catch (Exception ex) { error = "bombs at com " + ex.Message; } } } this is the code that creates the activeX object. var pdfLib = new Debenu.PDFLibraryAx(); if (pdfLib is object) { Debenu.PDFLibraryAx.unlocked = pdfLib.UnlockKey(Debenu.PDFLibraryAx.pdfKey) == 1; Debenu.PDFLibraryAx.renderer = pdfLib.SelectRenderer(2); if (Debenu.PDFLibraryAx.unlocked) { var ret = pdfLib.LoadFromVariant(fileBytes, Debenu.PDFLibrary.pdfKey); pdfLib.AddFreeTextAnnotation(100, 200, 300, 30, "Your mama don't dance", 0, 0); pdfLib.AddFreeTextAnnotation(100, 160, 300, 30, "and your daddy don't rock and roll", 0, 0); fileBytes = pdfLib.SaveToVariant(); } pdfLib.ReleaseLibrary(); pdfLib = null; } else { // "bombs in data, not an object "; } } catch (Exception ex) { // "bombs in data " + ex.Message; } Hopefully some brainiac, which I obviously am not, will pipe up and save me from this pain. I am shocked searching this site there was only one thread about azure. I had read that debenu will not work on azure because of GDI+ but I haven't gotten that far. I am hopeful if that is an issue using some of the other renderers available will solve that problem. I have used debenu in the past and really like it. Really want it to work. |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store