Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Converting to PDF hangs IIS

edited November 2007 in General
Hi,

We use ExtraDevices component to convert report to PDF for years without any
problems. Recently we started moving our Delphi project to web and faced
with the next problem. C# code calls DLL, written on Delphi, which creates
PDF file in a thread. This file is saved on a hard drive and C# picks it up
from there. Everything works fine for up to 18-20 concurrent connections. If
amount of concurrent connections grows up to 20-25 IIS hangs completely and
the only way to reactivate it - restart it. By the way, this happened only
for PDFFile device name, HTMLFile device works without any problems. If we
use native RB conversion to PDF - the same problem.



We use Windows Server 2005, Delphi 7, RB 9.03, ExtraDevices 3.0

fReport.TextFileName := fBaseURL + fRepName +'.'+ stExt;

fReport.ShowPrintDialog := False;

fReport.ShowCancelDialog := False;

fReport.AllowPrintToFile := True;

RepDevice := TPDFDevice.Create(self);

RepDevice.PrintToStream := True;

RepDevice.ReportStream := pStream;

RepDevice.Publisher := fReport.Publisher;

fReport.PrintToDevices; <--
problem line

pStream.SaveToFile(FileName);


where pStream is a memory stream. If we comment out "problem line" line
there is no any problem.


I'm not sure if problem happens in ExtraDevices component or in RB code,
it's not easy to debug it. It's happened only on win server, and never on my
XP Pro. If you have any info/idea how to fix or where to look at, I would
strictly appreciate it.

Best regards

Michael

Comments

  • edited November 2007
    Hi Michael
    Have your tried the DeviceExportToStream method of TExtraDevices?
    I use this often when generating pdf files for email queues.
    Just make sure to call the Loaded method of the ppReport component first and
    DO NOT call the Print method of the ppReport.
    eg
    var
    PDFStream:TMemoryStream

    //Create your streame object then call
    ppReport.Loaded
    DeviceExportToStream(ppReport,edFPDF,PDFStream);

    Similarly, TExtraDevices also has a native method to distill directory to a
    pdf file name. Not sure why you are creating the stream and saving it to
    file - manually?

    Dominic
  • edited November 2007
    Hi Michael,

    This particular issue is not known however we did recently fix a thread
    issue with the native PDF device for RB 10.07. This is one of many fixes we
    have made since the release of RB 9.03. I would suggest downloading a trial
    edition of RB 10.07 and testing your application with that (using the
    built-in PDF device... DeviceType := 'PDF'.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2007

    A few additional things to check for...

    - Make sure that you provide a thread-safe container for the report to
    execute.
    - Make sure that no dialogs are displayed by the report (i.e. set
    Report.ShowPrintDialog, ShowCancelDialog, etc to False.
    - Set Report.EnableProcessMessages to False.

    You can also try downloading a trial version of RB Server Edition and
    uitilizing its capabilties. We have an example of using the RB WebTier in a
    COM object that is called from ASP.NET...

    www.digital-metaphors.com/tips/AspDotNetWebTier.zip


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.