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 - Printer Properties - settings
  FAQ FAQ  Forum Search   Register Register  Login Login

Printer Properties - settings

 Post Reply Post Reply
Author
Message Reverse Sort Order
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Topic: Printer Properties - settings
    Posted: 20 Sep 13 at 10:38AM
Ian,

Which version of Quick PDF Library are you using. 9.15 and 9.16 should work reasonably well with DEVMODE.

I will make sure we review the documentation and add some sample code.  

I suspect it is not a bug but is based on how the code is implemented.

The GetPrinterDevModeToString function returns the currently active DEVMODE string for the custom printer.  Calling SetPrinterDevModeFromString doesn't actually update the DEVMODE until the actual call to PrintDocument.  SetPrinterDevModeFromString will save the string to a temporary buffer until the call to PrintDocument.  Again some better documentation would help here.

I would need to review the code full to determine why it is working this way and determine if it makes sense to update the DEVMODE straight away or not.  There must be some reason it was done this way in the first place.

Andrew.
Back to Top
ibigon View Drop Down
Beginner
Beginner


Joined: 01 Sep 13
Location: SF
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibigon Quote  Post ReplyReply Direct Link To This Post Posted: 20 Sep 13 at 10:10AM
Guys,

finally I was able to fix the problem. I did not call the "NewCustomPrinter" function before calling "SetPrinterDevModeFromString" - that was the problem. After this fix the printer accepts  the passed DEVMODE.

Unfortunatelly the documentation is very poor, and does not mention this fact.

The function GetPrinterDevModeToString is buggy, while it returns the default DEVMODE for my custom printer instead of the modified one.

std::wstring lMyPrinter = NewCustomPrinter(lSelPrinter);
int lRetVal = SetPrinterDevModeFromString(lMyDevModeStr);
std::string lTmpDevStr = GetPrinterDevModeToString(lMyPrinter);

BUG: lTmptDevStr is not equal to lMyDevModeStr, but the printer prints with using lMyDevModeStr

Thanks,
Ian

Back to Top
ibigon View Drop Down
Beginner
Beginner


Joined: 01 Sep 13
Location: SF
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibigon Quote  Post ReplyReply Direct Link To This Post Posted: 19 Sep 13 at 10:58PM
Hi, Thanks for your help.

I am using c++.
So finally I was able to correctly cast the std::string to DEVMODE and vice versa, but unfortunatelly the QPL SetPrinterDevModeFromString function is not working for me, and the PrintPages and PrintDocument functions prints always with default printer settings.

Here is my pseudo code:

std::string lOrigDevStr = GetPrinterDevModeToString(lSelPrinter); //get the default DEVMODE via QPL
LPDEVMODE lDevModeP; //declare and allocate memory for the lDevModeP data ...
//open printer, etc.

 DocumentProperties(hWnd,  hPrinter,  lSelPrinter,  lDevModeP,  NULL,  DM_OUT_BUFFER|DM_IN_PROMPT); /*Show the Printer Properties Dialog and get the the modified DEVMODE into lDevModeP output buffer */

std::string lModifiedDevStr (lDevModeP, lReqSize); //it is converted well to std::string
SetPrinterDevModeFromString(lModifiedDevStr ); //return value is 1, unfortunately undocumented

std::string lNewDevStr = GetPrinterDevModeToString(lSelPrinter);

... the read lNewDevStr is equal to initial lOrigDevStr, but it should be equal to lModifiedDevStr! The SetPrinterDevModeFromString function does not really changes the printer properties for me. Any help would be appreciated,
Thanks,
Ian















Edited by ibigon - 19 Sep 13 at 11:00PM
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 12 Sep 13 at 11:15AM
Ian,

Which programming language are you using ?

In C#, VB.NET it just needs to be a byte[] the same length as the DEVMODE structure.

In Delphi it is an AnsiString.

In other languages you need to call CreateBuffer, AddToBuffer and ReleaseBuffer functions to create the required string.

Andrew.




Back to Top
ibigon View Drop Down
Beginner
Beginner


Joined: 01 Sep 13
Location: SF
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibigon Quote  Post ReplyReply Direct Link To This Post Posted: 01 Sep 13 at 12:55PM
Hi,

is there any API to show the printers default properties dialog in DLL version?

I tried:
GetPrinterDevModeFromString
SetPrinterDevModeFromString

None of them showed the the standard properties dialog. I can show it with the win system call:
DocumentProperties with flag DM_IN_PROMPT

but how can I then pass the filled DEVMODE struct to QuickPDF lib?

Is there any conversion from DEVMODE to a correctly formatted string for SetPrinterDevModeFromString

Thanks,
Ian


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