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


All forums · Statistics · Search ·

Two Pilots forum / For software developers / Problem positioning RTFText and normal Text
Author Message
Theunissen
# Posted: 8 Jul 2010 07:19


Version in Use: 4.3.3153

We use PDFDocument4 to create PDFs. We do this with the DeviceContext to use the same code for preview, printing and PDFing. RTFs are printed via
PlayRTF = SendMessage(hRTF, EM_FORMATRANGE, Render, FR)
Normal text is printed via
TextOut .hDC, X, Y, Text, Len(Text)

The preview and the printed version are ok, but the PDF file shows elements, that should be at the same horizontal (or vertical) position with offsets.

Code at the start with hDC being the hDC from PDFDocument4:
SetMapMode hDC, MM_ANISOTROPIC
SetWindowExtEx hDC, .PaperWidth * gMetaFaktor, .PaperHeight * gMetaFaktor, ByVal 0&
LogX = GetDeviceCaps(hDC, LOGPIXELSX)
LogY = GetDeviceCaps(hDC, LOGPIXELSY)
ViewPortExtX = MulDiv(LogX, .PaperWidth, 1440&)
ViewPortExtY = MulDiv(LogY, .PaperHeight, 1440&)
SetViewportExtEx hDC, ViewPortExtX, ViewPortExtY, ByVal 0&

ViewPortOrgX = -GetDeviceCaps(hDC, PHYSICALOFFSETX) + MulDiv(m_DeviceOffsetX + m_OffsetX, LogX, 1440&)
ViewPortOrgY = -GetDeviceCaps(hDC, PHYSICALOFFSETY) + MulDiv(m_DeviceOffsetY + m_OffsetY, LogY, 1440&)
SetViewportOrgEx hDC, ViewPortOrgX, ViewPortOrgY, ByVal 0&

This code worked fine with PDFCreatorPilot2 (Version 2.70), which we used until now.

Can anybody help?

Artem
Member
# Posted: 8 Jul 2010 23:55


Dear Theunissen,

Could you send sample code for reproducing the problem? What is gMetaFaktor, PaperHeight, DeviceOffsetX, etc. Please use our online form to send us a message: http://www.colorpilot.com/support_contact.html.

--
Best regards,
Artem Golubnichenko

Two Pilots http://www.colorpilot.com

Theunissen
Member
# Posted: 13 Jul 2010 10:34


I sent you a sample program via contact form

Theunissen
Member
# Posted: 14 Jul 2010 02:37


From the changelog:
"July 4 2010
Fixed a bug in SetViewportExt record for isotropic mode in EMF."

If this is the solution to my problem, please rebuild the DLL and send me a notice :-)

Artem
Member
# Posted: 14 Jul 2010 03:07


Hello,

It is the latest build. It dll contains this fix.
http://www.colorpilot.com/~builds/PDFCreatorPilot4 _3_3157.zip

--
Best regards,
Artem Golubnichenko

Two Pilots http://www.colorpilot.com

Theunissen
Member
# Posted: 14 Jul 2010 05:08


:-(

Problem still exists with 3157.
Please try my sample code to see the difference between Version 2 and Version 4.

Artem
Member
# Posted: 19 Jul 2010 02:17


Hello,

Unfortunately, we don't support the library ver. 2 a long time. The current code (4.x) is independent of old code. Could you send the same code written on C++ or C# , please?

--
Best regards,
Artem Golubnichenko

Two Pilots http://www.colorpilot.com

Theunissen
Member
# Posted: 19 Jul 2010 09:20 · Edited by: Theunissen


Meanwhile I found the cause for the problem (at least I hope so):

First I show the code that works fine with Version 2:
SetMapMode hDC, MM_ANISOTROPIC
SetWindowExtEx hDC, A4WIDTH, A4HEIGHT, ByVal 0&
SetViewportOrgEx hDC, ViewPortOrgX, ViewPortOrgY, ByVal 0& ' we compensate the unprintable areas of our device
SetViewportExtEx hDC, ViewPortExtX, ViewPortExtY, ByVal 0&

'Call some routine that creates a font in our DC
PageCreateFont hDC, 12
TextOut hDC, 1& * TWIPSPERINCH, 1& * TWIPSPERINCH, SAMPLETEXT, Len(SAMPLETEXT) ' print at 1inch from left, 1inch from top

SetMapMode hDC, MM_TEXT
' Call some routine that prints the content of a RTF-control to our DC
PlayRTF RichTextBox1.hWnd, hDC, 1& * TWIPSPERINCH, 2& * TWIPSPERINCH, 6& * TWIPSPERINCH, 6& * TWIPSPERINCH ' Print at 1inch from left, 2 from top in a square box of 6 by 6


With Version 4 this code prints the RTF-text at some point down and right from the intended position. Today I inserted
SetViewportOrgEx hDC, ViewPortOrgX, ViewPortOrgY, ByVal 0& ' we compensate the unprintable areas of our device
after
SetMapMode hDC, MM_TEXT

Now everything prints fine!

So in Version 4 of your library, a "SetMapMode" resets some settings concerning the current ViewPort!!

Maybe you should correct this.

До свидания!
Hans-Gerd Theunissen

PS: I don't speak russian :-(

Artem
Member
# Posted: 20 Jul 2010 01:21


Hello Hans-Gerd,

Yes, you are right. We reset ViewPort Origin after SetMapMode for MM_TEXT. It is our mistake. We are trying to fix it.
Sorry for the inconvenience.

--
Best regards,
Artem Golubnichenko

Two Pilots http://www.colorpilot.com

Artem
Member
# Posted: 21 Jul 2010 01:57 · Edited by: Artem


Hello Hans-Gerd,

We've just fixed it. Please download the latest build here:
http://www.colorpilot.com/~builds/PDFCreatorPilot4 _3_3159.zip

--
Best regards,
Artem Golubnichenko

Two Pilots http://www.colorpilot.com

Theunissen
Member
# Posted: 26 Jul 2010 05:30


Thank you very much for your immediate help (as always !!!)

 

 

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

 

Page top