Center cover image
Posted: Sun Oct 05, 2014 4:45 pm
Hi Sergey,
I intend to put an image on the first page of an novels text document (cover image). The image should be centered vertically and horizontally and fit to the space inside the margins.
I do it that way as the first insertion in this document:
*) ParaStyle 4 means horizontally centered
It works fine, iamage is centered but there is a blank page in front of the cover page.
1. Why is the picture item number 1 and not 0? A few lines above I assign some properties and during first assignment a text item is created automatically (line with <<<):
Why is this item created?
2. If I leave the assignment of ParaStyle in that way:
then the blank page above fails but the image is not centered (in spite of the image is item 1 and not 0)
3. How can I center the image vertically?
4. In Word & Co I can assign several possibilities with the property 'page break' as 'with text in one line', 'square', 'fit', 'transparent', 'behind text' ...
Does this option also exist in ScaleRichView escpecially 'behind text'? Perhaps the task could be settled in that way?
I intend to put an image on the first page of an novels text document (cover image). The image should be centered vertically and horizontally and fit to the space inside the margins.
I do it that way as the first insertion in this document:
Code: Select all
Units := srvCo.UnitsProgram;
srvCo.UnitsProgram := rvuPixels;
Wi := Round(srvCo.PageProperty.PageWidth - srvCo.PageProperty.LeftMargin - srvCo.PageProperty.RightMargin) - 2;
He := Round(srvCo.PageProperty.PageHeight - srvCo.PageProperty.TopMargin - srvCo.PageProperty.BottomMargin) - 3;
CIm := TImage.Create(nil);
CIm.Picture.LoadFromFile(tlEx.Items[0].Strings[tcExImage.Index]);
R.AddPictureEx('Cover', CIm.Picture.Graphic, 4, rvvaBaseline); // *)
SV := CIm.Picture.Graphic.Height / CIm.Picture.Graphic.Width;
Gii := TRVGraphicItemInfo(R.GetItem(1));
if Round(He/Wi*100) >= Round(SV*100) then
begin
Gii.SetExtraIntProperty(rvepImageWidth, Wi);
Gii.SetExtraIntProperty(rvepImageHeight, Trunc(Wi*SV));
end
else
begin
Gii.SetExtraIntProperty(rvepImageWidth, Trunc(He/SV));
Gii.SetExtraIntProperty(rvepImageHeight, He);
end;
srvCo.UnitsProgram := Units;
It works fine, iamage is centered but there is a blank page in front of the cover page.
1. Why is the picture item number 1 and not 0? A few lines above I assign some properties and during first assignment a text item is created automatically (line with <<<):
Code: Select all
R.Clear;
if (R.Style = rvsComplete) or (R.Style = rvsCompleteUni) then
begin
srvCo.PageProperty.PageHeight := Str3ToFloat(tlPa.Items[cePageTemplate.ItemIndex].Strings[tcPaHeight.Index]); <<<<<<<<<<
. . .
2. If I leave the assignment of ParaStyle in that way:
Code: Select all
R.AddPictureEx('Cover', CIm.Picture.Graphic, -1, rvvaBaseline);
3. How can I center the image vertically?
4. In Word & Co I can assign several possibilities with the property 'page break' as 'with text in one line', 'square', 'fit', 'transparent', 'behind text' ...
Does this option also exist in ScaleRichView escpecially 'behind text'? Perhaps the task could be settled in that way?