FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ImportWMF - FWH 13.07 - Problem
Posts: 5
Joined: Tue May 20, 2008 04:00 PM
ImportWMF - FWH 13.07 - Problem
Posted: Thu Oct 10, 2013 03:24 PM

Hi

To print, I always used the logos in WMF format
I create the WMF page size and position the image of the logo in the correct location.
Now importWMF converts to EMF, and loses position just inside the WMF

Please, I have 1500 clients, can not change all logos.

Hugs

Marcelo

Posts: 5
Joined: Tue May 20, 2008 04:00 PM
Re: ImportWMF - FWH 13.07 - Problem
Posted: Thu Oct 10, 2013 04:37 PM

I need that WMF2EMF() convert WMF size page to EMF, today convert only the logo, and change the page size.

Please, help me.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: ImportWMF - FWH 13.07 - Problem
Posted: Fri Oct 11, 2013 07:27 AM
Marcelo,

FWH uses Windows SetWinMetaFileBits() to convert a WMF into an EMF:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd145103(v=vs.85).aspx
so there is nothing we can do there, but in Method ImportWMF() there are some places where you could adjust the dimensions:

in printer.prg:
Code (fw): Select all Collapse
   ::SetIsoTropicMode()
   ::SetWindowExt( GetDeviceCaps( ::hDC, HORZRES ),;
                   GetDeviceCaps( ::hDC, VERTRES ) ) //  aData[ 1 ], aData[ 2 ] )
   ::SetViewPortExt( GetDeviceCaps( ::hDC, HORZRES ),;
                     GetDeviceCaps( ::hDC, VERTRES ) ) //  aData[ 1 ], aData[ 2 ] )

   if ! ::lMeta
      SetViewOrg( ::hDCOut, -::nXoffset, -::nYoffset )
   endif


Maybe you could modify those values to have the right dimensions for you
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 5
Joined: Tue May 20, 2008 04:00 PM
Re: ImportWMF - FWH 13.07 - Problem
Posted: Fri Oct 11, 2013 02:13 PM
Hi Antonio

I tried this, but loses the top and left margin.

I think such a code loses these margins:
Code (fw): Select all Collapse
hOld = GetPMetaFile( cFile, aInfo )
hMeta = WMF2EMF( hOld, ::hDCOut )
or
Code (fw): Select all Collapse
PlayMetaFile( ::hDCOut, hWMF := EMF2WMF( hMeta, ::hDCOut ) )


printing without the logo: https://www.dropbox.com/s/dej8olj3dp98u2c/impressao%20sem%20logo.png
logo.wmf with margin: https://www.dropbox.com/s/sorprpavta3hxbc/logo.png
print with wrong logo: https://www.dropbox.com/s/5xz5ge5knpje5ig/impressao%20com%20logo%20errado.png
printing with the correct logo: https://www.dropbox.com/s/yh1m3ozkasqslnr/impressao%20com%20logo.png

Temporarily, I am using the tool htmltools to convert wmf to emf http://www.verypdf.com/app/html-converter/index.html
I put a code in importWmf() to convert using the htmltools.exe
Code (fw): Select all Collapse
winexec("htmltools.exe "+cFileWmf+" "+cFileEmf)


Anyway
thank you
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: ImportWMF - FWH 13.07 - Problem
Posted: Fri Oct 11, 2013 02:44 PM

Marcelo,

If the painting of the logo is just what it is failing, why don't you modify the logo to increase its top and left margins ? That may be a good workaround :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 5
Joined: Tue May 20, 2008 04:00 PM
Re: ImportWMF - FWH 13.07 - Problem
Posted: Fri Oct 11, 2013 03:02 PM

Hi Antonio

No problem, the htmltools.exe is a good solution.
I can't change the logo because I have 2 or 3 logo per client and 1500 clients, i think have more 4000 logo.

Thanks for the quick return

Marcelo

Continue the discussion