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 - Finding Printer Margins
  FAQ FAQ  Forum Search   Register Register  Login Login

Finding Printer Margins

 Post Reply Post Reply
Author
Message
stakon View Drop Down
Team Player
Team Player


Joined: 09 Oct 09
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote stakon Quote  Post ReplyReply Direct Link To This Post Topic: Finding Printer Margins
    Posted: 13 Oct 09 at 7:54AM
Good Day,

I am using QuickPDF to print some engineering manuals where precision matters.

So when i print a PDF i cannot use the "Page Scaling" option because then the printed dimensions will not be accurate.
The solution is to find the printer margins, and create a cropBox not containing them.
Ideally i would like to make my application print correctly in different printers.
My question is:  Is there a way to find the printer Margins using QuickPDF?

Thanx in advance,

Stakon.

Back to Top
DELBEKE View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 31 Oct 05
Location: France
Status: Offline
Points: 151
Post Options Post Options   Thanks (0) Thanks(0)   Quote DELBEKE Quote  Post ReplyReply Direct Link To This Post Posted: 15 Oct 09 at 6:52AM
You can use Wndows apis to find printer margins
    PortraitOffsetX = GetDeviceCaps(Printer.hDC, PHYSICALOFFSETX)
    PortraitOffsetY = GetDeviceCaps(Printer.hDC, PHYSICALOFFSETY)
    PrnWidth = GetDeviceCaps(Dc, PHYSICALWIDTH)
    PrnHeight = GetDeviceCaps(Dc, PHYSICALHEIGHT)
Back to Top
stakon View Drop Down
Team Player
Team Player


Joined: 09 Oct 09
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote stakon Quote  Post ReplyReply Direct Link To This Post Posted: 15 Oct 09 at 9:26AM
Thank you DELBEKE,

    Note that :
    PrnWidth = GetDeviceCaps(Dc, PHYSICALWIDTH)
    PrnHeight = GetDeviceCaps(Dc, PHYSICALHEIGHT)
   
    return the actual paper's width/heigth , not the printable area.

After doing some further research:
    PortraitOffsetX = GetDeviceCaps(Printer.hDC, PHYSICALOFFSETX)
    PortraitOffsetY = GetDeviceCaps(Printer.hDC, PHYSICALOFFSETY)
 
    return the real printer offsets from top and left (ie. the position where the printer can start
     printing)
    the measurement  returned in Device Units which is essentially DU = dpi*inches
    So we have to know our printer's dpi to calculate our document in inches/milimeters
    This is achieved by :
    CPrintDialog dlg(FALSE);
    app->GetPrinterDeviceDefaults(&dlg.m_pd)
    LPDEVMODE devmode = dlg.GetDevMode();
    short dpi = devmode->dmPrintQuality;



   
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