save report to PDF
How do I convert an already viewed report to PDF (report been printed to the
screen). I don't want to reprint it and reset the devicetype from Screen to
PDF.
I use report builder 9.01.
Report.print // this will view it on the screen
savetoPDF; // I want something here to save it to PDF with no user
interaction
thanks
screen). I don't want to reprint it and reset the devicetype from Screen to
PDF.
I use report builder 9.01.
Report.print // this will view it on the screen
savetoPDF; // I want something here to save it to PDF with no user
interaction
thanks
This discussion has been closed.
Comments
Adding ppPDFDevice to your uses clause will enable exporting to PDF at
runtime. See the TppPDFDevice topic in the ReportBuilder help for detailed
instructions on exporting to PDF and some sample code of doing so.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
report. I am trying to undertand why printing to a PDF file takes a long
time. Previewing the same report on the screen take 20 seconds. Viewing it
in PDF format takes up to 5 minutes.
I am trying to make the PDF report quicker. Is there a way to save the
previewed report to PDF without using reprinting the report by redirecting
the devicetype to PDF?
thanks,
Here is a routine called from a custom button in my preview form,
printing the already viewed report to a rtf file, and then opening the
file (for example in Word).
(Using Delphi 6.02, RBuilder 7.02, and ExtraDevices, but it may be easy
to adapt to your case)
procedure TgtcRBPreview.PrintToWord;
var
sTempFile : string;
begin
sTempFile := FindUniqueFileName(FindTempReportFolder, 'ProMan',
'.dot');
PrintToFile(sTempFile, SRTFDeviceName);
// Open in Word.
if FileExists(sTempFile) then
begin
slTempFiles.Add(sTempFile);
ShellExecEx(sTempFile);
end;
FocusToKeyCatcher;
end;
-tor
ReportBuilder consists of numerous "device" objects. Each device has the
capability of outputting a report to a specific medium. When you call
Report.Print, the report engine will work through each object you have
placed on your report and generate DrawCommand objects for each one of them.
These DrawCommands contain all the basic information to draw the object.
The separate devices use the information in their own way to output each
object to the specific medium. For instance the TppScreenDevice generates
commands to draw report objects to the screen, the TppPrinterDevice - to the
printer.
Generating a report to screen and generating a report to PDF have no
correlation except they use the same drawcommands. This is why it is
necessary to regenerate when printing to any device. We have tested the PDF
Device with many different reports and have not seen a time difference
between report generation and PDF generation as great as yours. What do you
have your compression level set to? What does your report consist of? How
many pages? Is this a text based report or does it contain numerous images?
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks,
on Rowchange. the compression is set to default. I am using the report in a
web application. the users get frustrated after waiting for 5 minutes to see
the report. I tried the same report in preview screen and it takes less than
20 seconds.
I don't know why.
Thanks,
support@digital-metaphors.com so I can test it on my machine.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Oh, sorry. I forgot to include both routines. (And you can of course
substitute the FindUniqueFileName line with some file name logic of
your own.)
That said, this may not be what you are looking for. I am calling
Report.Print, so the report is generated anew.
procedure TgtcRBPreview.PrintToFile(const sFile, sDevice: string);
var
sSaveDevType : string;
begin
if Report = nil then
Exit;
if (Assigned(BeforePrint)) then
BeforePrint(Self);
// Generate report output file.
Report.ShowPrintDialog := False;
Report.ShowAutoSearchDialog := False;
sSaveDevType := Report.DeviceType;
try
Report.DeviceType := sDevice;
Report.TextFileName := sFile;
Report.Print;
finally
Report.ShowPrintDialog := True;
Report.ShowAutoSearchDialog := True;
Report.DeviceType := sSaveDevType;
if (Assigned(AfterPrint)) then
AfterPrint(Self);
end;
end;
I think this should be