Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > General Discussion
  New Posts New Posts RSS Feed - Another Changing Trays question
  FAQ FAQ  Forum Search   Register Register  Login Login

Another Changing Trays question

 Post Reply Post Reply
Author
Message
BobW View Drop Down
Senior Member
Senior Member


Joined: 27 Feb 13
Location: Minnesota
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote BobW Quote  Post ReplyReply Direct Link To This Post Topic: Another Changing Trays question
    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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
jack97119 View Drop Down
Beginner
Beginner
Avatar

Joined: 28 Dec 21
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote jack97119 Quote  Post ReplyReply Direct Link To This Post 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;



Edited by jack97119 - 28 Dec 21 at 10:58AM
Back to Top
jack97119 View Drop Down
Beginner
Beginner
Avatar

Joined: 28 Dec 21
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote jack97119 Quote  Post ReplyReply Direct Link To This Post 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;

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store