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 > I need help - I can help
  New Posts New Posts RSS Feed - how to let get GetPrinterDevModeToString  printDi
  FAQ FAQ  Forum Search   Register Register  Login Login

how to let get GetPrinterDevModeToString printDi

 Post Reply Post Reply
Author
Message
mitchellhu View Drop Down
Beginner
Beginner
Avatar

Joined: 11 Jul 13
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote mitchellhu Quote  Post ReplyReply Direct Link To This Post Topic: how to let get GetPrinterDevModeToString printDi
    Posted: 12 Jun 20 at 3:19AM
1.DenbenuPdf library Version : DebenuPDFLibrary1211
2.Develop Tool : Delphi Xe2 update 4

Try to use GetPrinterDevModeToString to save Delphi TPrinterDialog setting;
but I found it is seem impossibe, because the Delphi TprinterDialg no any printsettings
variable to keep setting. 

I use QP.GetPrinterDevModeToString to keep the settings, but it seems get the default setting only,
so use use QP.SetPrinterDevModeFromString and QP.PrintDocument will get print PDf file size no as expected.

nomorely, a MS Excel file can be setup print size by its printsetupDialg , then print the right size as he/she need. so , I think Debenupdf library could do it correctly also, 
Please give some suggestion.
//P.S: Why Debenu/Foxit support system seems not working any more!!!
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3156
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 12 Jun 20 at 8:49PM
"...
Why Debenu/Foxit support system seems not working any more?
..."

There was another user few days ago telling about good contact with the support team.
For me it's the same... I send normal emails and i get an answer.
Perhaps you want to discuss a problem which can't be solved with QuickPDF?

Cheers,
Ingo

Back to Top
mitchellhu View Drop Down
Beginner
Beginner
Avatar

Joined: 11 Jul 13
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote mitchellhu Quote  Post ReplyReply Direct Link To This Post Posted: 17 Jun 20 at 12:31AM
Thanks for you replay.
I make a support on Foxit/Denbenu web last week, but still have no any replay from then.
I buy DebenuPdflibray1211 for Delphi form Denbenu. 
Before Denbenu merge into Foxit, Denbenu always help me to solve problem quickly , but even get a reply is impossible. 
sorry for my bad English ability, maybe I miss some contact information on the web site. 
please show me the correct way(mail) to contact them.

Thank you.
Back to Top
mitchellhu View Drop Down
Beginner
Beginner
Avatar

Joined: 11 Jul 13
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote mitchellhu Quote  Post ReplyReply Direct Link To This Post Posted: 17 Jun 20 at 3:24PM
try to some test , still not work.....I do not know why
=============================================================
//button1 : get the printer 'CutePDF Writer' DevMode data to AnsiString variable : DeModeString
=============================================================
procedure TForm1.Button1Click(Sender: TObject);
var
  QP : TDebenuPDFlibrary1211;
begin
  if PrinterSetupDialog1.Execute then // change the papersize form A4 to A2
  begin
    QP := TDebenuPDFlibrary1211.Create;
    DeModeString := QP.GetPrinterDevModeToString('CutePDF Writer');
    QP.Free;
  end;
end;

==============================================================
Button3: set newprinter('CutePDF Writer') and set DevMode data from AnsiString variable : DeModeString
==============================================================
procedure TForm1.Button3Click(Sender: TObject);
VAR
  QP : TDebenuPDFlibrary1211;
  printoptions : Integer;
  newPrinter : string;
begin
   QP := TDebenuPDFlibrary1211.Create;
   QP.UnlockKey('myregkey');
   QP.LoadFromFile(sFilenameEdit1.Text,'');
   printoptions := QP.PrintOptions(1, 0, 'test');
   newPrinter := QP.NewCustomPrinter('CutePDF Writer');
   QP.SetPrinterDevModeFromString(DeModeString);
   QP.PrintDocument(newPrinter , 1, 1, printoptions); //
   Qp.Free
end;
===========================================================
but the print out file size is A4 not A2

I do not know why?



Edited by Ingo - 17 Jun 20 at 6:30PM
Back to Top
mitchellhu View Drop Down
Beginner
Beginner
Avatar

Joined: 11 Jul 13
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote mitchellhu Quote  Post ReplyReply Direct Link To This Post Posted: 19 Jun 20 at 2:12AM
finally, I got contact with Foxit.
and they prove GetPrinterDevModeToString(MyPrinter) function contains a bug in QPL before version 18.11. also , they apply a alternative solution to get DeMode Sting as below:

var

  DevModeString: AnsiString;

  PrinterName: string;


procedure TForm1.btnGetDevModClick(Sender: TObject);

var

  MyPrinter, MyDriver, MyPort: array[0..255] of Char;

  DeviceHandle: THandle;

  DevMode: PDeviceMode;

  DevModeLen: Integer;

begin

  if PrinterSetupDialog1.Execute then

  begin

    Printer.GetPrinter(MyPrinter, MyDriver, MyPort, DeviceHandle);


    // This function contains a bug in QPL before version 18.11

    // DevModeString := QP.GetPrinterDevModeToString(MyPrinter);


    // Get the devmode string directly from the printer

    if DeviceHandle <> 0 then

    begin

      DevMode := GlobalLock(DeviceHandle);

      if (SizeOf(DevMode^) = DevMode^.dmSize) then

      begin

        DevModeLen := DevMode^.dmSize + DevMode^.dmDriverExtra;

        SetLength(DevModeString, DevModeLen);

        if (DevModeLen > 0) then

        begin

          Move(DevMode^, DevModeString[1], DevModeLen);

        end;

      end;

      GlobalUnlock(DeviceHandle);

    end;


    PrinterName := MyPrinter;

  end;

end;


procedure TForm1.btnPrintClick(Sender: TObject);

var

  CustomPrinter: string;

begin

  QP.SetPrinterDevModeFromString(DevModeString);

  CustomPrinter := QP.NewCustomPrinter(PrinterName);

  QP.DrawText(100, QP.PageHeight - 100, 'Top Left');

  QP.DrawText(100, 100, 'Bottom Left');

  QP.DrawText(QP.PageWidth - 100, 100, 'Bottom Right');

  QP.DrawText(QP.PageWidth - 100, QP.PageHeight - 100, 'Top Right');

  QP.PrintDocument(CustomPrinter, 1, 1, QP.PrintOptions(1, 0, 'My Doc'));

end;

so, case close.
Thanks for Ingo's replay , let me try to contact to again and again . Ha! Ha!
finally...... Foxit/Debenu still good as usual!


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