View Issue Details

IDProjectCategoryView StatusLast Update
0037265FPCFCLpublic2020-07-03 21:34
ReporterAlan Chamberlain Assigned ToMichael Van Canneyt  
Status assignedResolutionopen 
Product Version3.2.0 
Summary0037265: fcl-pdf TransformMatrix not set properly for PaperType ptCustom
DescriptionSetting TPDFDocument.DefaultPaperType to ptCustom with TPDFDocument.Option [poPageOriginAtTop] causes TransformMatrix to be incorrectly initialised.
Steps To ReproducePlace the following in a procedure and execute

var FDoc:TPDFDocument;
FDoc := TPDFDocument.Create(Nil);
FDoc.Infos.Title := Application.Title;
FDoc.Infos.Author := 'Me';
FDoc.Infos.Producer := 'fpGUI Toolkit 1.4.1';
FDoc.Infos.ApplicationName := ApplicationName;
FDoc.Infos.CreationDate := Now;

FDoc.Options := [poPageOriginAtTop];
FDoc.FontDirectory := 'fonts';

Section := FDoc.Sections.AddSection;

FDoc.DefaultOrientation := ppoLandscape;
FDoc.DefaultUnitOfMeasure := uomPixels;
FDoc.DefaultPaperType := ptCustom

CustomPaper.H := DH + 2*MT;
CustomPaper.W := DW + 2*ML;
CustomPaper.Printable.T := 10;
CustomPaper.Printable.L := 10;
CustomPaper.Printable.R := CustomPaper.W - 10;
CustomPaper.Printable.B := CustomPaper.H - 10;

APage := FDoc.Pages.AddPage;
APage.Paper := CustomPaper;
APage.PaperType := FDoc.DefaultPaperType; {does not trigger anything as papertype is the same as previous}

{Print something...}

Additional InformationTPDFPage.Create initialises the paper and paper size as A4 and then sets the defaults. For ptCustom the paper size is not set and TransformMatrix is set on the A4 size. TPDFPage.SetPaperType and TPDFPage.Orientation both exit without executing AdjustMatrix as these settings are the same as previous.

Work around:
Insert if APage.Orientation = ppoPortrait then {work around to trigger adjustmatrix}
   APage.Orientation := ppoLandscape;
   APage.Orientation := ppoPortrait;
   APage.Orientation := ppoPortrait;
   APage.Orientation := ppoLandscape;

after APage.Paper := CustomPaper;

Possible fix:
In TPDFPage.SetPaperType delete
 if FPaperType=AValue then Exit;

so that AdjustMatrix is always executed.
TagsNo tags attached.
Fixed in Revision
Attached Files


Marco van de Voort

2020-07-01 10:38

manager   ~0123695

Not being familiar with fcl-pdf I only looked, and adjustmatrix use paperheight, and I'm not sure if it is good practice to manditorily having to set dimensions before setting papertype to ptcustom. Some explicit call for that case might be better?

Issue History

Date Modified Username Field Change
2020-06-26 10:00 Alan Chamberlain New Issue
2020-07-01 10:38 Marco van de Voort Note Added: 0123695
2020-07-03 21:34 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-07-03 21:34 Michael Van Canneyt Status new => assigned