Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support

All forums · Statistics · Search ·

Two Pilots forum / For software developers / SetMapMode vs Device Unit
Author Message
Dominique Savoie
# Posted: 7 Jul 2008 12:09


We are evaluating your libary to decide if we are going to use it.

I am using HDC to print our reports because our code is based on HDC and Gdi to print on printers.

We use device independant unit to position our drawing. So we put the HDC in TWIPS.

The radius of the fonction RoundRect are calculated in device units (300dpi) instead of logical units(TWIPS 1440) so the corner are bigger than it should.

Here is a sample of our code:
Read the comments in the code.

pO_ExpPDF->UseScreenBasedDC = false;
pO_ExpPDF->PageResolution = pS_PrintWmf->pO_ExpPDF->GetDCResolution();

pO_ExpPDF->PageWidth = l_PageWidthPDF;
pO_ExpPDF->PageHeight = l_PageHeightPDF;
Hdc = (HDC)pO_ExpPDF->GetDC();
SetMapMode (Hdc, MM_TWIPS);

//Pt_Origin and Rc_Dim are in TWIPS and output is fine
ExtTextOut (Hdc, Pt_Origin.x, Pt_Origin.y, bs_OptOut, &Rc_Dim, psz_Srce, i_Len,NULL);

//Rc_Rect and RoundWitdh, RoundHeight are in TWIPS
//Size of Rectangle is fine
//Radius of corner are not fine. They are drawn in device unit, not in TWIPS
RoundRect (

The resolution of the printer driver can be changed in the printer properties to 300 dpi, 600 dpi or 1200 dpi. When we change the resolution, the radius of the corner of the rectangle change according to the resolution (dpi) of the driver. Bigger for 300 dpi, smaller for 1200 dpi.

It is not suppose to do that. The size of the text and the rectangle are ok not the corners.

# Posted: 7 Jul 2008 12:17 · Edited by: Stanislav

Dear Dominique,

I assume this is a bug. I've just added this issue in the bugtracker, our developers are on vacation now, they will be available in a two weeks. When they will be avalable, i think they will inform you about this issue status. Sorry for any inconvenience.

Best regards,
Two Pilots

Vitaliy Shibaev
# Posted: 22 Jul 2008 00:02

Hi Dominique,

Thank you for your letter! You're completely right - corner width and height were not scaled. Now we fix it, here is the current intermediate build:

For correct library registration do following:
1) Please, remove all version of PDF Creator which are installed in your

2) Go to C:/Windows/system32 and try to found PDFCreatorPilot.dll. If
found run command "regsvr32 /u PDFCreatorPilot.dll". Then delete
* You may also look for PDFCreatorPilot.dll on all your hard disk.
Delete all such files.

3) Reboot.

4) Register new build using "regsvr32 PDFCreatorPilot.dll"

Best regards,
Vitaliy Shibaev
Two Pilots



Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.020


Page top