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!
![]() |
how to let get GetPrinterDevModeToString printDi |
Post Reply ![]() |
Author | |
mitchellhu ![]() Beginner ![]() ![]() Joined: 11 Jul 13 Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() 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!!! |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
"...
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 |
|
![]() |
|
mitchellhu ![]() Beginner ![]() ![]() Joined: 11 Jul 13 Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
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. |
|
![]() |
|
mitchellhu ![]() Beginner ![]() ![]() Joined: 11 Jul 13 Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
mitchellhu ![]() Beginner ![]() ![]() Joined: 11 Jul 13 Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
finally, I got contact with Foxit.
and they prove GetPrinterDevModeToString( var DevModeString: AnsiString; PrinterName: string; procedure TForm1.btnGetDevModClick( 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( // 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. CustomPrinter := QP.NewCustomPrinter( 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( end; |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store