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

Problem when outputting to pdf

edited July 2005 in General
D7, WinXP SP2, RB 9.02 Ent

I'm trying to sent a report to a pdf file without user intervention using
the code below:

begin
if fileexists('C:\Orders.pdf') then
deletefile('c:\Orders.pdf');

dm1.Specials.Open;
dm1.H220.Open;
dm1.H220.IndexName := 'rep_date';
dm1.H220.SetScope(formatdatetime('yyyymmdd', fromdate.date),
formatdatetime('yyyymmdd', todate.date));
if emailreport.Checked then
begin
Rpt.Reset;
PPDBTEXT4.DisplayFormat := '';
Rpt.AllowPrintToFile := True;
Rpt.TextFileName := 'c:\orders.pdf';
Rpt.DeviceType := 'PDF';
Rpt.ShowPrintDialog := False;
Rpt.Print;
end
else
begin
PPDBTEXT4.DisplayFormat := '**********************';
Rpt.AllowPrintToFile := False;
Rpt.DeviceType := dtScreen;
Rpt.ShowPrintDialog := True;
Rpt.Print;
end;
end;


If the emailreport is checked the the output file i.e. orders.pdf contins no
data - however if I output the report to the screen then the report is fine
i.e. shows data for select dates.

I placed a dbgrid on the screen to see where things were going wrong. If
the output is directed to pdf then as the rpt.print is processed the dbgrid
goes blank. Help.

btw. removing the setscope on the datafile the whole file is output ok to
the pdf file. ???

Comments

  • edited July 2005
    Hi Steve,

    If possible, please send a small example demonstrating this behavior in .zip
    format to support@digital-metaphors.com and I'll take a look at it for you.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2005
    Hi Nico,

    I use apollo tables and I think the problem is when a scope has been set. I
    will investigate the problem further. The strange thing is that output to
    the screen and selecting output then to file (pdffile) works ok ??
  • edited July 2005
    Hi Steve,

    Yes that is very strange. If you would like, you can send me a copy of the
    pdf file that shows this behavior and I can look at the PDF code for clues
    to what is happening. Just be sure to export to PDF with the
    CompressionLevel property in the PDFSettings set to "None".

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.