TppPDFDevice to stream, RAP events do not execute
Hi all,
I recently upgraded from RB7 to RB15. I had a procedure called
"ExportReportToPDF". In the old version I used the wpCubed PDF
exporter. Given the great improvement in RB's ppPDFDevice, I changed to
it. However, whenever I use this procedure with ppPDFDevice, It seems to
ignore any pass-thru RAP functions, I see it go through GetSignature &
HasParams but it never hits ExecuteFunction. The only difference I
observe when running it through the screen preview it that it goes
through GetSignature & HasParams twice, then ExecuteFunction. Is there
some setting of ppPDFDevice that I need to adjust to make sure it
executes the custom pass-through functions?
Here's my code:
RBpdf:=TppPDFDevice.Create(Self);
try
//zStream:=TMemoryStream.Create;
RBpdf.OutputStream:=zStream;
RBpdf.Publisher := Reports.Publisher;
Reports.PrintToDevices;
zStream.Position:=0;
if not UseStream then
zStream.SaveToFile(zFileName);
finally
RBpdf.Free;
Thanks.
-Dan Armstrong
This discussion has been closed.
Comments
I just performed a test using the latest version of ReportBuilder
(16.03) with code identical to yours and a very simple RAP passthru
function and it executed correctly without any errors.
Please create a simple example I can run here that demonstrates this
behavior and send it to me in .zip format and I'll test it here and
track down the problem. Send the example to support@digital-metaphors.com.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Any way you could email me your simple demo? I'm not terribly proficient
at creating simple demos. I seem to be missing my /RBuilder/Demos folder.
Unfortunately the example I created will give errors as it was created
with RB 16.03.
Which RAP event are you calling your passthru function from? Depending
on the event, you may need to make a call to InitializeParameters before
calling PrintToDevices to ensure it fires correctly.
RBpdf := TppPDFDevice.Create(Self);
try
//zStream:=TMemoryStream.Create;
RBpdf.OutputStream := zStream;
RBpdf.Publisher := Reports.Publisher;
if Reports.InitializeParameters then //Initialize Report Parameters
Reports.PrintToDevices;
zStream.Position := 0;
if not UseStream then
zStream.SaveToFile(zFileName);
finally
RBpdf.Free;
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
InitializeParameters did the trick.
The RAP function the report is calling the function from is procedure
GlobalOnCreate.