View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0037265 | FPC | FCL | public | 2020-06-26 10:00 | 2020-11-13 07:38 |
Reporter | Alan Chamberlain | Assigned To | Michael Van Canneyt | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | i86_64 | OS | Fedora | ||
Product Version | 3.2.0 | ||||
Fixed in Version | 3.3.1 | ||||
Summary | 0037265: fcl-pdf TransformMatrix not set properly for PaperType ptCustom | ||||
Description | Setting TPDFDocument.DefaultPaperType to ptCustom with TPDFDocument.Option [poPageOriginAtTop] causes TransformMatrix to be incorrectly initialised. | ||||
Steps To Reproduce | Place the following in a procedure and execute var FDoc:TPDFDocument; APage:TPDFPage; CustomPaper:TPDFPaper; DW,DH:integer; begin 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'; FDoc.StartDocument; 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...} FDoc.SaveToFile(FileName); FDoc.Destroy; end; | ||||
Additional Information | TPDFPage.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} begin APage.Orientation := ppoLandscape; APage.Orientation := ppoPortrait; end else begin APage.Orientation := ppoPortrait; APage.Orientation := ppoLandscape; end; after APage.Paper := CustomPaper; Possible fix: In TPDFPage.SetPaperType delete if FPaperType=AValue then Exit; so that AdjustMatrix is always executed. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 47394 | ||||
FPCOldBugId | |||||
FPCTarget | 3.2.2 | ||||
Attached Files |
|
|
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? |
|
Fixed. Setting paper type and paper now triggers the matrix calculation. Manually setting paper will automatically set the paper type to ptCustom. Thanks for reporting. |
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 |
2020-11-12 11:49 | Michael Van Canneyt | Status | assigned => resolved |
2020-11-12 11:49 | Michael Van Canneyt | Resolution | open => fixed |
2020-11-12 11:49 | Michael Van Canneyt | Fixed in Version | => 3.3.1 |
2020-11-12 11:49 | Michael Van Canneyt | Fixed in Revision | => 47394 |
2020-11-12 11:49 | Michael Van Canneyt | FPCTarget | => 3.2.2 |
2020-11-12 11:49 | Michael Van Canneyt | Note Added: 0126856 |