Print Page | Close Window

Another Changing Trays question

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3783
Printed Date: 22 Nov 24 at 1:19PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Another Changing Trays question
Posted By: BobW
Subject: Another Changing Trays question
Date Posted: 17 Feb 20 at 4:32PM
I also have a question about changing trays.  Using the library, I can look at each page of my PDF and determine which tray I want to draw from.  I created a custom printer and can change its tray during printing  My problem is that it creates a new print spool job each time I switch trays.  For instance if I see the first 5 pages go to tray 2:
set the tray to 2 and PrintPages 1-5 
then change the tray to 3 and PrintPages 6
then change the tray the back to 2 and PrintPages 7-11, etc.

This can potentially create hundreds of spool jobs (I create a print very large PDFs).

Is there any way I can perform this in a single print job?  If not, this would be a great feature to add.  Something like:

StartPrinter
print to tray 2
print to tray 3
print to tray 2
EndPrinter



Replies:
Posted By: Ingo
Date Posted: 18 Feb 20 at 10:13PM
Hi Bob,

that's not possible:
https://www.debenu.com/kb/can-print-different-printer-trays/
Ideas for further enhancements you should post into the official page regarding technical issues.
Here's the user/user-community...



-------------
Cheers,
Ingo



Posted By: jack97119
Date Posted: 28 Dec 21 at 10:57AM
    Printer.BeginDoc;
    //dosomething...print

    //--------- Changing Trays .... -----------------
    Printer.GetPrinter(device, driver, port, hDMode);
    if (hDMode <> 0) then
    begin
      pDMode := GlobalLock(hDMode);
      if Assigned(pDMode) then
      begin         
          pDMode.dmFields := pDMode.dmFields or DMBIN_MANUAL;
          pDMode.dmDefaultSource :=GetTraysID(); 
         winapi.Windows.EndPage( Printer.Handle );   
         If ResetDC( Printer.canvas.Handle, pDMode^ ) = 0 Then
                showmessage( 'ResetDC failed, '+SysErrorMessage(GetLastError));
         GlobalUnlock( hDMode );
         winapi.Windows.StartPage( Printer.Handle );
         Printer.Canvas.Refresh;
      end;
    //--------------------------------------------------

    //dosomething...print
    Printer.EndDoc;
    end;



Posted By: jack97119
Date Posted: 28 Dec 21 at 11:00AM
  function GetTraysID()(TraysName: string; adevice, aport: PWideChar): Word;
  var
    i, rslt: Integer;
    tBinNames: array of Tbinname;
    BinCodes: array of Word;
  begin
    Result := DM_DEFAULTSOURCE;
    rslt := devicecapabilitiesW(adevice, aport, dc_binnames, nil, nil);
    if rslt > 0 then
    begin
      setlength(tBinNames, rslt);
      setlength(BinCodes, rslt);
      try
        if devicecapabilitiesW(adevice, aport, dc_binnames, @tBinNames[0],
          nil) = -1 then
        begin
          setlength(BinCodes, 0);
          setlength(tBinNames, 0);
          raise exception.Create('error tbinnames');
        end;
        if devicecapabilitiesW(adevice, aport, DC_BINS, @BinCodes[0], nil) = -1
        then
        begin
          setlength(BinCodes, 0);
          setlength(tBinNames, 0);
          raise exception.Create('error  BinCodes');
        end;

        for i := 0 to rslt - 1 do
        begin
          if TraysName = tBinNames then
          begin
            Result := BinCodes;
            Break;
          end;
        end;
      finally
        setlength(BinCodes, 0);
        setlength(tBinNames, 0);
      end;
    end;
  end;




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk