 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Bill C Guest
|
Posted: Tue Mar 20, 2007 2:16 pm Post subject: Create PDF file |
|
|
G'day all,
Delphi 7 Pro, Word 2000, MSSQL server 7
My database prepares reports as Word docs (actually in RTF) for
printing and these can be saved to a local directory.
Using nothing more than Rave (ie no further software), I would
like to take this Word file and convert it to a PDF. Tip #96 in
Nevrona's Tips and Tricks suggests you can do this, but I think
there are code errors in their example. I certainly can't get it
to work. It would be good if this could be done in code,
without using the Rave visual designer.
As usual, everyone's guidance and suggestions are appreciated.
Cheers
Bill |
|
| Back to top |
|
 |
Bill C Guest
|
Posted: Wed Mar 21, 2007 8:13 am Post subject: Re: Create PDF file |
|
|
Thanks for your reply Trevor,
Tip #96 does report to a stream, but the final line of code is
OutStream.SaveToFile('test.pdf');
The Tip comment is "In the example the PDF file is saved to file
as one of the last steps."
The problem I have is that the code doesn't run. I think there
are 2 errors (undeclared identifiers)
RvRenderPDF1.Engine := RvNDRWriter1;
RvRenderPDF1.Execute;
RvRenderPDF1 doesn't have a property "Engine" nor a function
"Execute" (I have a very limited understanding of Rave, but am
OK with Delphi)
I am looking to:
1. get a Word file from disk using
RichEdit1.LoadFromFile('WordFile.doc')
2. put it into a memory stream (RichEdit.SaveToStream(NdrStream)) then
3. save it as a PDF (using Tip #96 code).
Thanks for your further comments
Cheers
Bill
"Trevor Keegan" <tkeegan (AT) ealink (DOT) com> wrote:
| Quote: | Hello Bill,
What is the problem that you are having?
If I look at tip #96, it is not converting a Word file into PDF, it is only
reporting directly into PDF file a stream....is this what you are wanting to
do?
Regards
Trevor Keegan
|
|
|
| Back to top |
|
 |
Trevor Keegan Guest
|
Posted: Wed Mar 21, 2007 8:13 am Post subject: Re: Create PDF file |
|
|
Hello Bill,
What is the problem that you are having?
If I look at tip #96, it is not converting a Word file into PDF, it is only
reporting directly into PDF file a stream....is this what you are wanting to
do?
Regards
Trevor Keegan |
|
| Back to top |
|
 |
clacke Guest
|
Posted: Thu Mar 22, 2007 12:05 am Post subject: Re: Create PDF file |
|
|
Bill,
| Quote: |
Thanks for your reply Trevor,
Tip #96 does report to a stream, but the final line of code is
OutStream.SaveToFile('test.pdf');
The Tip comment is "In the example the PDF file is saved to file
as one of the last steps."
The problem I have is that the code doesn't run. I think there
are 2 errors (undeclared identifiers)
RvRenderPDF1.Engine := RvNDRWriter1;
RvRenderPDF1.Execute;
RvRenderPDF1 doesn't have a property "Engine" nor a function
"Execute" (I have a very limited understanding of Rave, but am
OK with Delphi)
I am looking to:
1. get a Word file from disk using
RichEdit1.LoadFromFile('WordFile.doc')
2. put it into a memory stream (RichEdit.SaveToStream(NdrStream)) then
3. save it as a PDF (using Tip #96 code).
Thanks for your further comments
Cheers
Bill
"Trevor Keegan" <tkeegan (AT) ealink (DOT) com> wrote:
Hello Bill,
What is the problem that you are having?
If I look at tip #96, it is not converting a Word file into PDF, it is
only
reporting directly into PDF file a stream....is this what you are wanting
to
do?
Regards
Trevor Keegan
|
You cannot produce a pdf starting from another output produced by Rave.
So, you could produce your report from scratch in pdf format.
Following a procedure you could copy to produce a pdf by code:
procedure CreatePDF(FileName: string);
var
tmpRvp: TRvProject;
tmpRvs: TRvSystem;
tmpRPdf: TRvRenderPDF;
begin
try
tmpRvp := TRvProject.Create(Self);
tmpRvs := TRvSystem.Create(Self);
tmpRPdf := TRvRenderPDF.Create(Self);
tmpRvp.Engine := tmpRvs;
tmpRvp.ProjectFile := 'C:\MyDirectory\project1.rav';
tmpRvs.DefaultDest := rdFile;
tmpRvs.DoNativeOutput := false;
tmpRvs.RenderObject := tmpRPdf;
tmpRvs.OutputFileName := FileName;
tmpRvs.SystemSetups := tmpRvs.SystemSetups - [ssAllowSetup];
tmpRvs.SystemOptions := [];
tmpRvp.Open;
tmpRvp.ExecuteReport('Report1');
tmpRvp.Close;
finally
tmpRvp.Free;
tmpRvs.Free;
tmpRPdf.Free;
end; |
|
| Back to top |
|
 |
Eldon Lewis Guest
|
Posted: Thu Mar 22, 2007 5:25 am Post subject: Re: Create PDF file |
|
|
| Quote: | The problem I have is that the code doesn't run. I think there
are 2 errors (undeclared identifiers)
RvRenderPDF1.Engine := RvNDRWriter1;
RvRenderPDF1.Execute;
RvRenderPDF1 doesn't have a property "Engine" nor a function
"Execute" (I have a very limited understanding of Rave, but am
OK with Delphi)
|
I have updated the tip and trick. The two statements above should reference
RvProject1 instead of RvRenderPdf1.
I apologize for the typos.
Eldon Lewis
Nevrona Designs |
|
| Back to top |
|
 |
Bill C Guest
|
Posted: Thu Mar 22, 2007 8:13 am Post subject: Re: Create PDF file - apology from Nevrona re tip #96 |
|
|
G'day all,
Just received an email from Nevrona, as follows... (!)
"Bill,
I apologize for the typos in the tip and trick. I have now
corrected the error and the code that is out there now should
work just fine.
Best Regards,
Technical Support
Nevrona Designs"
Cheers
Bill
"Bill C" <wcarey (AT) NOTadam (DOT) com.au> wrote:
| Quote: |
G'day all,
Delphi 7 Pro, Word 2000, MSSQL server 7
My database prepares reports as Word docs (actually in RTF) for
printing and these can be saved to a local directory.
Using nothing more than Rave (ie no further software), I would
like to take this Word file and convert it to a PDF. Tip #96 in
Nevrona's Tips and Tricks suggests you can do this, but I think
there are code errors in their example. I certainly can't get it
to work. It would be good if this could be done in code,
without using the Rave visual designer.
As usual, everyone's guidance and suggestions are appreciated.
Cheers
Bill |
|
|
| Back to top |
|
 |
Bill C Guest
|
Posted: Thu Mar 22, 2007 8:13 am Post subject: Re: Create PDF file |
|
|
"clacke",
But what (in general terms) is contained in Project1?
I already have a Word file on disk (created via Word automation
- not Rave).
My idea as indicated was as follows:
1. get the Word file from disk using
RichEdit1.LoadFromFile('WordFile.doc')
2. put it into a memory stream (RichEdit.SaveToStream(NdrStream)) then
3. save it as a PDF via Rave (using Tip #96 code).
Won't this work?
Cheers
Bill
"clacke" <clacke.nospamplease (AT) tiscali (DOT) nospamplease.it> wrote:
| Quote: | You cannot produce a pdf starting from another output produced by Rave.
So, you could produce your report from scratch in pdf format.
Following a procedure you could copy to produce a pdf by code:
procedure CreatePDF(FileName: string);
var
tmpRvp: TRvProject;
tmpRvs: TRvSystem;
tmpRPdf: TRvRenderPDF;
begin
try
tmpRvp := TRvProject.Create(Self);
tmpRvs := TRvSystem.Create(Self);
tmpRPdf := TRvRenderPDF.Create(Self);
tmpRvp.Engine := tmpRvs;
tmpRvp.ProjectFile := 'C:\MyDirectory\project1.rav';
tmpRvs.DefaultDest := rdFile;
tmpRvs.DoNativeOutput := false;
tmpRvs.RenderObject := tmpRPdf;
tmpRvs.OutputFileName := FileName;
tmpRvs.SystemSetups := tmpRvs.SystemSetups - [ssAllowSetup];
tmpRvs.SystemOptions := [];
tmpRvp.Open;
tmpRvp.ExecuteReport('Report1');
tmpRvp.Close;
finally
tmpRvp.Free;
tmpRvs.Free;
tmpRPdf.Free;
end;
|
|
|
| Back to top |
|
 |
Eldon Lewis Guest
|
Posted: Fri Mar 23, 2007 3:05 am Post subject: Re: Create PDF file |
|
|
Bill,
| Quote: | But what (in general terms) is contained in Project1?
I already have a Word file on disk (created via Word automation
- not Rave).
My idea as indicated was as follows:
1. get the Word file from disk using
RichEdit1.LoadFromFile('WordFile.doc')
2. put it into a memory stream (RichEdit.SaveToStream(NdrStream)) then
3. save it as a PDF via Rave (using Tip #96 code).
Won't this work?
Cheers
Bill
|
If the WordFile.doc is an rtf file then it should work just fine because
Rave can import rtf. However, most .doc files are not rtf files and Rave
would not be able to make the conversion.
Eldon Lewis
Nevrona Designs |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|