Recent

Author Topic: [SOLVED] How to get and set the paper size  (Read 113 times)

What I can do

  • Jr. Member
  • **
  • Posts: 99
[SOLVED] How to get and set the paper size
« on: September 25, 2024, 01:04:30 pm »
FPC:Lazarus 3.4
OS :Windows 10@64
Project: make a Record for print jobs one of the elements in PJob.Size:TPageSize;

Problem: PJob.Size.Text:=Printer.PaperSize.SupportedPapers.Text;
This is not a normal TStrings it has a lot of pointer variables.
Would like to
1) read the value of the Printer.Papersize store in PJob.Size (success)
2) change and send PJob.Size back to the Printer.Papersize  (?)
   pJob.Size:=DMPAPER_LETTER; //Identifier not found:ERROR

----------UPDATE
hack around and found a work around
Change pJob.Size : TPaperSize; to  pJob.Size : Integer;

{  read Paper size }
pJob.Size:=Printer.PagerSize.SupportedPapers.IndexOf('Legal');

{Set Paper size}
 Printer.PaperSize.SupportedPapers[pJob.Size];   
« Last Edit: September 25, 2024, 01:44:11 pm by What I can do »

 

TinyPortal © 2005-2018