Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - [SOLVED]Markup printing broken in XTP v17
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[SOLVED]Markup printing broken in XTP v17

 Post Reply Post Reply
Author
Message
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 441
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED]Markup printing broken in XTP v17
    Posted: 22 February 2016 at 4:34pm
Hello,

It appears that the markup printing is not working as expected in XTP v17 and later.

A simple way to demonstrate the problem is to start the CodeJock MarkupPad utility. Load any valid markup, and then attempt to print. The resulting output will be disproportionately sized. We use the same code as MarkupPad in our applications (e.g. we use CXTPMarkupPrintingContext, which derives from CXTPMarkupDrawingContext).

Markup printing worked fine in the v16 release cycle.

Any ideas for a workaround?

Regards,

Mark R.
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 441
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 23 February 2016 at 4:22pm
I noticed something else strange about this problem - print preview works as expected. 

Again, you can see this in MarkupPad - load any XAML and check the print preview. It renders correctly, but the actual print out does not.

What might be the cause of this?

- Mark R.
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 23 February 2016 at 6:39pm
I haven't looked at the code or anything but symptoms as described

"preview is good, actual output not"

can often be attributed to the physical "printer offset" either wrong or not factored in.

That would be my guess. Hope you can get it straightened out.
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 441
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 24 February 2016 at 12:48am
Originally posted by Algae Algae wrote:

can often be attributed to the physical "printer offset" either wrong or not factored in.

Thanks for the info, but I'm not sure what you mean by this. Could you provide a reference to additional information on this topic?

- Mark R.
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 24 February 2016 at 12:55pm
Hi Mark,

*Here is a quick example of Printer Offset that I referred to. This sets up a page for printing. The "physical" sizes are used to adjust the "paper" to the printer device in case it is not one to one.

    CPrintDialog    printer( TRUE, PD_RETURNDC );
    printer.GetDefaults();
    HDC    hdc = printer.GetPrinterDC();
    if( hdc )
    {
        int horzSize = ::GetDeviceCaps( hdc, PHYSICALWIDTH );
        int vertSize = ::GetDeviceCaps( hdc, PHYSICALHEIGHT );

        int leftMargin = ::GetDeviceCaps( hdc, PHYSICALOFFSETX );
        int topMargin = ::GetDeviceCaps( hdc, PHYSICALOFFSETY );

        int horzPrintable = ::GetDeviceCaps( hdc, HORZRES );
        int vertPrintable = ::GetDeviceCaps( hdc, VERTRES );

        int rightMargin = horzSize - ( horzPrintable + leftMargin );
        int bottomMargin = vertSize - ( vertPrintable + topMargin );
    }
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 441
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2016 at 4:08pm
Still no fix for this in 17.2.  :-(

- Mark R.
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 441
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 21 June 2016 at 4:11pm
Any chance of getting this fixed for the upcoming minor release?

- Mark R.
Back to Top
agontarenko View Drop Down
Admin Group
Admin Group


Joined: 25 March 2016
Status: Offline
Points: 260
Post Options Post Options   Thanks (1) Thanks(1)   Quote agontarenko Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2016 at 2:14am
Hello,

I am glad to inform you, this issue has been fixed. Fix will be avaleble in next beta or final release.
As hotfix you can change file XTPMarkupGdiPlusDeviceContext.cpp

 - in fuction void CXTPMarkupGdiPlusDeviceContext::Init(BOOL bReInit /*= FALSE*/) add string m_pGdiPlus->GdipSetPageUnit(GetGraphics(), UnitPixel);

 - in function virtual void Commit() change
            pGDIP->GdipDrawImage(m_pDCEx->GetGraphics(),
                m_pOffscreenImage,
                static_cast<REAL>(m_rect.left),
                static_cast<REAL>(m_rect.top));

to
            pGDIP->GdipDrawImageRect(m_pDCEx->GetGraphics(),
                m_pOffscreenImage,
                static_cast<REAL>(m_rect.left),
                static_cast<REAL>(m_rect.top),
                static_cast<REAL>(m_rect.Width()),
                static_cast<REAL>(m_rect.Height()));


Regards,
Artem Gontarenko
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 441
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2016 at 10:52am
Hi Artem,

Thanks for the fix, it appears to be working correctly now. Clap

Regards,

Mark R.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.