merging 2 rtf files into 1 single rtf & converting to pd

General TRichView support forum. Please post your questions here
Post Reply
Sweet
Posts: 6
Joined: Tue Jun 06, 2006 9:47 am

merging 2 rtf files into 1 single rtf & converting to pd

Post by Sweet »

Hi !

I've got a strange problem.
I have 2 rtf files. I want to merge them into 1 single rtf file.
Then, I want to create a pdf file with this rtf file.
So I use TRichViewPDF.
My problem : my final single rtf file sounds good...but when converting it to pdf file, it's not good.
sample_1.rtf is a bigger rtf file than sample_2.rtf...so in my final pdf file, it's just like as if sample_1.rtf overwrites sample2.rtf
So I don't have my whole sample2.rtf visible in the final pdf...
I hope you understand what I mean (forgive my french accent :wink:)
Here is my code :

=====================================
begin
RichViewEdit1.Clear ;
RichViewEdit1.LoadRTF('C:\Temp\sample_1.rtf') ;
RichViewEdit1.Format ;
RichViewEdit1.LoadRTF('C:\Temp\sample_2.rtf') ;

RichViewEdit1.Format ;
RichViewEdit1.SaveRTF('C:\Temp\result.rtf', False) ;

with TRichViewPDF.Create(nil) do
try
AutoLaunch := true ;
CreateOutlines := true ;

RichView.LoadRTF('C:\Temp\result.rtf') ;
SaveToPDFFile('C:\Temp\result.pdf') ;
finally
free ;
end ;
end ;
======================================

Another "easy question" : how can I change page when I load new rtf ?
I mean, in my final rtf file, I want :

sample_1.rtf
<then starting on a new page :>
sample_2.rtf

Thanks very very much in advance for your support,
Laurent.
Sergey Tkachenko
Site Admin
Posts: 17310
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I do not know default property values for TRichViewPDF.RichView.
Make sure that
TRichViewPDF.RichView.RTFReadProperties.ParaStyleMode =
TRichViewPDF.RichView.RTFReadProperties.TextStyleMode = rvrsAddIfNeeded.

As for adding page break before the second file:

Code: Select all

var ItemCount: Integer;

RichViewEdit1.Clear ; 
RichViewEdit1.LoadRTF('C:\Temp\sample_1.rtf') ; 
ItemCount := RichViewEdit1.ItemCount;
RichViewEdit1.LoadRTF('C:\Temp\sample_2.rtf') ; 
if RichViewEdit1.ItemCount>ItemCount then
  RichViewEdit1.PageBreaksBeforeItems[ItemCount] := True;
Sweet
Posts: 6
Joined: Tue Jun 06, 2006 9:47 am

Post by Sweet »

Thank you very much !!!
Finally, I got one pb : adding page break before second file.

And you found the solution !!! :P
THANK YOU !
Post Reply