This way EMF is placed to PDF output using the code like this:
Code: Select all
HRESULT PDFXBuilder::PlaceMetafile(PageItem* pageItem, HENHMETAFILE hMeta, const PXC::PXC_Rect& rc)
{
HRESULT hr = S_OK;
try
{
CComPtr<PXC::IPXC_XForm> pXForm;
hr = m_pCoreDoc->ConvertMetafile((PXC::HANDLE_T)hMeta, 0, nullptr, &pXForm);
if (FAILED(hr))
return hr;
return PlaceXForm(pageItem, pXForm, rc);
}
catch( ... )
{
return -1;
}
}
We have issue, which we really need to get rid of.
DASH and DOT styled lines are not displayed ( parsed ) properly.
I remember we discussed that GDI+ EMF format is hard to support. However, we switched to plain GDI to draw lines properly, but still have bad results.
I'm attaching the resulted PDF & EMF. Code, which draws the dash line looks as this:
Code: Select all
CPen pen;
HPEN hPen = ::ExtCreatePen(PS_GEOMETRIC | m_pPen->GetDashStyle(), iLineWidth ,&lb, 0, NULL);
BOOL bAttached = pen.Attach(hPen );
//////////////////////////////////////////////////////////////
CPen* pOldPen = pDC->SelectObject( &pen );
for( UINT i = 0; i < m_vPoints.size(); i++ )
{
PointF pt = m_vPoints[i];
_parent->ToStage( pt );
GetLayer()->FromStage( pt );
if(i == 0 )
pDC->MoveTo( (int)(pt.X * fScale + 0.5), (int)(pt.Y * fScale + 0.5) );
// pDC->MoveTo( std::ceil( pt.X*fScale ), std::ceil( pt.Y*fScale ) );
else
pDC->LineTo( (int)(pt.X * fScale + 0.5), (int)(pt.Y * fScale + 0.5) );
// pDC->LineTo( std::ceil( pt.X*fScale ),std::ceil( pt.Y*fScale ) );
}
pDC->SelectObject(pOldPen);
pGr->ReleaseHDC( hdc );
Regards,
Yury