One PDF file per page or group change?
Hi,
Asked a similar question on devices newsgroup but no answers so thought I'd
ask here
How would I create a separate PDF file (separate file names) per page (or
group change) of a report? Ideally there would be an option to specify the
filename per page/group (maybe a hook somewhere per page/group where you
could assign the PDF file name, according to a db field or similar).
Regards
Alex
Asked a similar question on devices newsgroup but no answers so thought I'd
ask here
How would I create a separate PDF file (separate file names) per page (or
group change) of a report? Ideally there would be an option to specify the
filename per page/group (maybe a hook somewhere per page/group where you
could assign the PDF file name, according to a db field or similar).
Regards
Alex
This discussion has been closed.
Comments
You will need to use the TppFileDevice's ReceivePage method to separate out
each page and send it to a newly created TxtraDevice (TPDFDevice). Then you
can call Report.PrintToDevices for each page and print each page as a new
file. Below is an example that creates two print devices and sends pages to
each one individually as the device receives them. This should give you a
good starting point.
http://www.digital-metaphors.com/tips/PrintToMultiplePrinters.zip
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
out
you
to
Hi!
I have this problem (one page per PDF) too. When I'm running the code
mentioned below I have an exception on "pdf.ReceivePage(lPage)". The same
thing happens when I replace TPDFDevice with TppTextFileDevice or
TppArchiveDevice. But everything is fine when I'm using TppPrinterDevice.
What am I doing wrong?
procedure TForm1.Button1Click(Sender: TObject);
begin
FDevice:=TppDevice.Create(self);
FDevice.Publisher:=ppReport1.Publisher;
FDevice.OnPageReceive := ehDevicePageReceive;
ppReport1.AllowPrintToFile:=true;
ppReport1.PrintToDevices;
FDevice.Free;
end;
procedure TForm1.ehDevicePageReceive(Sender, aPage: TObject);
var
lPage: TppPage;
pdf: TPDFDevice;
begin
lPage:=TppPage(aPage);
pdf:=TPDFDevice.Create(self);
pdf.FileName:='c:\'+IntToStr(lPage.AbsolutePageNo)+'.pdf';
pdf.StartJob;
pdf.ReceivePage(lPage);
pdf.EndJob;
pdf.Free;
end;
What type of exception are you receiving? Be sure that aPage is not nil.
If possible send an example in .zip format to support@digital-metaphors.com.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
support@digital-metaphors.com.
It's all right... Sorry...
I forgot to assign pdf.Publisher, when I did it, everything worked fine.
It's strange, but in case of using TppPrinterDevice there is no need to
assign device's Publisher property.