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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Printing PDF via DLL from service causing Hang
  FAQ FAQ  Forum Search   Register Register  Login Login

Printing PDF via DLL from service causing Hang

 Post Reply Post Reply
Author
Message
GField View Drop Down
Beginner
Beginner
Avatar

Joined: 01 Mar 10
Location: Reigate, UK
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote GField Quote  Post ReplyReply Direct Link To This Post Topic: Printing PDF via DLL from service causing Hang
    Posted: 01 Mar 10 at 9:17PM
Hi
I'm using the DLL to print PDFs created via a merge process.  The Service (Metastorm BPM) is a workflow tool running an web application. I have create a fascade class with static members to perform a number of methods including GetPrinters and Print Document.
 
The web page calls via the service to the methods below. The printer name is correct and the process works most of the time.  Once I have pruinted a PDF, if I wait 20 minutes or so, the Metatsorm service hangs with a message, failed to read address.
 
Faulting application dllhost.exe, version 5.1.2600.5512, stamp 48025165, faulting module unknown, version 0.0.0.0, stamp 00000000, debug? 0, fault address 0x09c87b9c.
 
Is this because I haven't released the library. I have looked through various examples and none appear to release the library after instantiating, although your Getting started documentation mentions it, I'm not instantiating the DLL that way and can't get the release to run.
 
I'm running XP Pro, with IIS running in .net 2.0. Can you check if the class is ok? The Metastorm service and application has been working fine until I implemented the PDF printing section this morning. I've run the code through nunit individually with successful.  When I attempt to request 100 prints of the same PDF i get the following error (after requesting 38 copies)

TestQuickPDFFascade.TestPrintPDFToPrinter : Failed

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at QuickPDFDLL0717.DLL.DelegateII.Invoke(Int32 P1)
at QuickPDFDLL0717.DLL.Release() in QuickPDFDLL0717.cs: line 1187
at QuickPDFDLL0717.DLL.Finalize() in QuickPDFDLL0717.cs: line 1178
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at QuickPDFDLL0717.DLL.DelegateI.Invoke()
at QuickPDFDLL0717.PDFLibrary..ctor(String dllFileName) in QuickPDFDLL0717.cs: line 1906
at FieldConsultancy.Correspondence.CorresAction.QuickPDFFascade.GetQpLibrary(String quickPdflibraryFile) in QuickPDFFascade.cs: line 129
at FieldConsultancy.Correspondence.CorresAction.QuickPDFFascade.PrintPDFFileToPrinter(String quickPdflibraryFileString fileNameString printerNameNullable`1 startPageNullable`1 endPage) in QuickPDFFascade.cs: line 101
at FieldConsultancy.CorrespondenceTest.TestQuickPDFFascade.TestPrintPDFToPrinter() in TestQuickPDFFascade.cs: line 97
 
If you need any more information, let me know
Thanks
Graham Field
 
 
 
The Nunit code is:
 

[Test]

public void TestPrintPDFToPrinter()

{

for (var i = 0; i < 100;i++ )

{

Assert.AreEqual(1,

QuickPDFFascade.PrintPDFFileToPrinter(_pdfLibraryFile, "tempHtml2.PDF",

"Auto EPSON Stylus Photo RX640 Series on CAS02", 1, 1));

}

}

Code from Fascade is:-
 

public static int PrintPDFFileToPrinter(string quickPdflibraryFile, string fileName,

string printerName, int? startPage, int? endPage)

{

if (!File.Exists(fileName))

{

throw new FileNotFoundException("pdf File not found", fileName);

}

if (!fileName.ToLower().EndsWith(".pdf"))

{

throw new FileLoadException("Not a PDF File", fileName);

}

PDFLibrary qp = GetQpLibrary(quickPdflibraryFile);

if (qp.LoadFromFile(fileName) == 0)

{

throw new FileLoadException("Cannot load PDF file", fileName);

}

if (startPage == null)

{

startPage = 1;

}

if (endPage == null)

{

endPage = qp.PageCount();

}

if (printerName == "")

{

printerName = GetDefaultPrinter(qp);

}

int printOptions = qp.PrintOptions(0, 0, fileName);

return qp.PrintDocument(printerName, (int)startPage, (int)endPage, printOptions);

}

 

public static string GetPrinters(string quickPdflibraryFile)

{

PDFLibrary qp = GetQpLibrary(quickPdflibraryFile);

string printers = qp.GetPrinterNames();

return printers.Replace("\"", "");

}

private static PDFLibrary GetQpLibrary(string quickPdflibraryFile)

{

PDFLibrary qp = new PDFLibrary(quickPdflibraryFile);

if (qp.LibraryLoaded())

{

if (qp.UnlockKey("My Evaluation key here") != 1)

{

throw new ApplicationException("******* QuickPDF Key not Working ***********");

}

}

return qp;

}

Cheers
Graham Field

Field Consultancy Ltd
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store