WPCubed Product Support

How can I print to a specific paper tray ?

wpsupport

COMPDF_SetPagePaperBin is reserved, the intention is to set a paper bin for a selected page. But this is not a standard PDF feature.

But there is

COMPDF_SelectPrinterBin0 = 38; // set PrinterBin / PaperTray default

COMPDF_SelectPrinterBin1 = 39; // PrinterBin for first page

You will need the id of a paper tray how it is defined for that specific printer. The default tray ids usually do not work.

Internally the ID is set during printing in

DevMode.dmDefaultSource

Regards,

Julian

#2 ♥ 0
3.8k Views 2 users read 1 min

Hello all,

I have the followning printroutine which works fine - but howto enhance it to allow the choice of a specific paper tray number? Thanks for any advice.

procedure PrintPDF(APrinterIndex: Integer; AFileName: String; APrintTitle: String);

var

  vForm: TForm; 

  vWpViewPDF: TWPViewPDF;

begin

  vForm := TForm.Create(nil);

  vForm.Visible := False;

  vWpViewPDF := TWPViewPDF.Create(vForm);

  vWpViewPDF.Parent := vForm;

  try

    vWpViewPDF.filename := AFileName;

    vWpViewPDF.CommandStr(COMPDF_SetPrintTitle, APrintTitle);

    vWpViewPDF.command(COMPDF_SetPagePaperBin, 39);

    vWPViewPDF.BeginPrint(Printer.Printers[APrinterIndex]);

    vWPViewPDF.PrintPages(1, vWpViewPDF.PageCount);

    vWPViewPDF.EndPrint;

  finally

    FreeAndNil(vWpViewPDF);

    FreeAndNil(vForm);

  end;

end;

Best regards

Michael Eriksen

#1 ♥ 0