#1 2011-07-11 16:07:33

hovecricketer
Member
Registered: 2011-07-11
Posts: 3

Newbie having a problem scaling

Hi

Just starting using pdf engine.

I'm using pdf engine as part of a routine to convert a MS Word doc into a pdf.

I copy the word doc to the clipboard, and then (using some code from this forum!)....

With TPdfDocument.Create do
try
PDFA1 := True;
DefaultPaperSize := psA4;

AddPage;

MS := TMetaFile.Create;
MF.Enhanced := True;
try
    MF.Assign(Clipboard);
    sScale   := 1;
    sXoff     := 25;
    sYoff     := -120;
    Canvas.RenderMetaFile(MF, sScale, sXoff, sYoff, False, 99, 101);
finally
   MF.Free;
end

finally
    Free;
End;


It works OK except that the image/text is too small, i.e. rather than taking up half a page, it's more like just the top left corner.

I've tried using the 'scale' parameter in RenderMetaFile, but it doesn't seem to do anything.

Can anyone point me in the right direction with what I'm doing wrong?

thanks

steve

Offline

#2 2011-07-11 17:36:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: Newbie having a problem scaling

The scaling depends on the metafile size.

You have to adjust sScale so that it will fit the page as wished.

Offline

#3 2011-07-11 18:58:59

hovecricketer
Member
Registered: 2011-07-11
Posts: 3

Re: Newbie having a problem scaling

Thanks ab

I've tried quite a range of values for sScale, none of which had any effect. 

In what way does the "scaling depend on the metafile size"?

I'll take a longer look at the TMetaFile object and see if anything stands out.  What's happening at the moment is that the data is actually being shrunk, for some reason, and the only reason I can think of at the moment is that there's a lot of white space defined in the data being assigned to the meta file. The question here is should the adjustments be made to the MetaFile, or during the rendering process (with changes to the parameters, e.g. scale), or perhaps to the Canvas itself?

Any help would be much appreciated!

steve

Offline

Board footer

Powered by FluxBB