I have a Richtext field, that current is being drawn in a PDF, though different resolutions are effecting how it appears
procedure PrintToMetaFile(LineNum: Integer);
const
ADJUST_PIXELS = 2;
var
MF: TMetafile;
MFC: TMetafileCanvas;
R: TRect;
ActualHeight: Integer;
LastLine: Integer;
begin
// Define the draw rect area (100% only).
R.Left := LeftDots;
R.Top := TopDots;
R.Right := WidthDots + LeftDots;
R.Bottom := HeightDots + TopDots;
// Create the metafile and set its dimensions.
MF := TMetafile.Create;
try
MF.Height := HeightDots;
MF.Width := WidthDots;
// Create the metafile canvas and draw to it.
MFC := TMetafileCanvas.Create(MF, Canvas.Handle);
try
// Draw the WPRichText at 100% zoom.
MFC.Brush.Color := PrintColor;
// HeightDots + 2 to ensure last line is printed. (Until such time as more accurate method can be used).
ActualHeight := HeightDots + ADJUST_PIXELS;
MFC.FillRect(Rect(0, 0, WidthDots, ActualHeight));
// Get the last line that was printed in this clone.
FLastLineNum:= WPC.Draw(MFC, 0, 0, MF.height, LineNum, 0) - 1;
finally
// Freeing the metafile canvas actually saves it to the metafile object with which it is associated.
MFC.Free;
end;
// Apply zoom factor by way of adjusting the drawn rectangle.
R.Left := Trunc(R.Left * ZoomFactor);
R.Top := Trunc(R.Top * ZoomFactor);
R.Right := Trunc(R.Right * ZoomFactor);
R.Bottom := Trunc(R.Bottom * ZoomFactor);
// Stretch draw creates the illusion of zooming.
Canvas.StretchDraw(R, MF);
finally
MF.Free;
end;
end;
Alles anzeigen
The above is the area of code I believe needs to be changed. Is there some way that when this code is executed it believes it is always at a set resolution?
The issue I am getting are in the following pdf's
"http://www.microgenx.com/Real Estate Lament 1440 narrow res.pdf"
"http://www.microgenx.com/Real Estate Lament 1440 wide res.pdf"
Current control settings are
WPC.WYSIWYG := False;
WPC.ScreenResMode := rm1440;
I have investigated WPTool5 and the new calculations in that looked promising though there is a heavy amount of coding in this application dependant on PTLine and backward compatibility would be a major issue.
Thanks for any help :)