Note that there are some explanatory texts on larger screens.

plurals
  1. POGenerating PDF with Quick Reports behind a Delphi Web Server
    primarykey
    data
    text
    <p>I have a Delphi web server providing some web services*. One of them is supposed to generate and return a PDF report.</p> <p>The PDF creation is done with a QReport that is then exported into a PDF file with the ExportToFilter procedure.</p> <p>The routine works fine when called from within an application, but when called behind a TIdTCPServer, it hangs and never finishes. Debugging it, I got tho the hanging point:</p> <p><em>(note: I'm home right now and I don't have the source code. I'll try to reproduce quickrpt.pas' source as accurrate as I can remember).</em></p> <pre><code>procedure TCustomReport.ExportToFilter(TQRDocumentFilter filter); ... AProgress := TQRFormProgress.Create(Application); // Hangs on this line AProgress.Owner := QReport; if ShowProgress then AProgress.Show; QReport.Client := AProgress; ... </code></pre> <p>Searching the web, I found in <a href="http://coding.derkeiler.com/Archive/Delphi/borland.public.delphi.thirdpartytools.general/2006-09/msg00013.html" rel="nofollow noreferrer">this page</a> (1) the suggestion to set ShowProgress to False, and edit the code so that it does not create the progress form when ShowProgress is set to false (apparently, this is due to QReport not being threadsafe).</p> <p>So, I edited the code, and now I have this:</p> <pre><code>procedure TCustomReport.ExportToFilter(TQRDocumentFilter filter); ... if ShowProgress then begin AProgress := TQRFormProgress.Create(Application); AProgress.Owner := QReport; AProgress.Show; QReport.Client := AProgress end; ... </code></pre> <p>Now, the report comes out. But then the service gets to an Invalid Pointer Exception (which I can't trace). Following calls to the service complete successfully, but when I shut down the service** it starts whining again with Invalid Pointer Exceptions, then the "MyServer has commited an invalid action and must be closed" windows message, then again a couple of times more, then just the pointer exception, then comes to error 216 (which as far as I could find out, is related to Windows access permissions).</p> <p>Thanks!</p> <p><strong>Update (jan 5)</strong>: Thanks Scott W. for your <a href="https://stackoverflow.com/questions/401743/generating-pdf-with-quick-reports-behind-a-delphi-web-server#411789">answer</a>. Indeed, after some research, I found another suggestion that only the main thread can access some components. So I set the QR code back to normal and called the main method from a Synchronize call inside a TThread (so that way the main thread would handle it). But I still get the same error.</p> <p>You mention you were able to generate PDF as a service with QR 4. Maybe that's why it's not working for me, since I'm using QR 3. On the other hand, you don't mention if you're doing that behind a TIdTCPServer (which is my case, providing web services) or if you run it by itself (for instance, during a batch process).</p> <p>Anybody knows whether my QR version might be the problem? Thanks!</p> <p>* Running Delphi 7 and QuickReport 3 on a Windows XP SP2. The server is based on Indy.</p> <p>** I have two versions of the server: a Windows application and a Windows Service. Both call the same inner logic, and the problem occurs with both versions.</p> <p><strong>Update (mar 8)</strong>: After all, my problem was that my printing routine was in another dll, and the default memory management module is somewhat crappy. Setting the first uses of my .dpr to be ShareMem overrides the memory management module with Borland's implementation, and solved my problem.</p> <pre><code>uses ShareMem, ... </code></pre> <p>(1): <a href="http://coding.derkeiler.com/Archive/Delphi/borland.public.delphi.thirdpartytools.general/2006-09/msg00013.html" rel="nofollow noreferrer">http://coding.derkeiler.com/Archive/Delphi/borland.public.delphi.thirdpartytools.general/2006-09/msg00013.html</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload