Lazarus

Programming => LCL => Topic started by: Brightfall on August 30, 2019, 09:12:18 am

Title: fppdf - How to create custom sized pages?
Post by: Brightfall on August 30, 2019, 09:12:18 am
I have been playing with FPPDF and have it working OK, but have not been able to figure out how to set the page to a custom size. I can see that I need to set the PaperType to ptCustom, but can't see how to set the height and width for it. Thought I could set the Paper Height and Width, but the argument cant be assigned values. I am obviously missing something.

pdfPage.Paper.H := 1000;   <=== Argument cannot be assigned to
pdfPage.Paper.W := 1000;  <=== Argument cannot be assigned to
pdfPage.PaperType := ptCustom;


Am hoping this is not a dumb question! It has been some years since I have done any coding, and that used to be in Delphi and Windows. Am now messing with Lazarus/FP on MacOS.


Any help appreciated.
Title: Re: fppdf - How to create custom sized pages?
Post by: wp on August 30, 2019, 09:48:55 am
pdfPage.Paper is a record TPDFPage. You can only assign another complete TPDFPaper to this property, not individual elements. Therefore, do this:
Code: Pascal  [Select][+][-]
  1. var
  2.   paper: TPDFPaper;
  3. ...
  4.   paper := pdfPage.Paper;
  5.   paper.H := 1000;
  6.   paper.W := 1000;
  7.   pdfPage.Paper := paper;
Title: Re: fppdf - How to create custom sized pages?
Post by: Brightfall on August 30, 2019, 02:15:52 pm
Yep, that works perfectly.

Thanks wp. Greatly appreciated!
TinyPortal © 2005-2018