SALVATAGGIO DI EMF CON FREEIMAGE

Moderator: Enrico Maria Giordano

SALVATAGGIO DI EMF CON FREEIMAGE

Postby Silvio » Sun Jun 18, 2006 8:39 am

come si puo salvare le pagine dell'anteprima di stampa con la funzione save di freeimage della classe Image di EMG

SaveImage( cFile, nFormat, nFlag ) CLASS TImage
// 0 -> Bmp
// 2 -> Jpg
// 13 -> Png


per adesso sono riuscito a salvare ogni pagina di un report ma in emf ovviamente senza usare la freeimage

Secondo Voi come potrei dire che tale pagine (EMF) la devo considerare come un Image ?

grazie
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: SALVATAGGIO DI EMF CON FREEIMAGE

Postby Enrico Maria Giordano » Sun Jun 18, 2006 9:50 am

Non puoi dato che la FreeImage non gestisce né WMF né EMF. Questi formati sono gestiti dalla GFLSDK e da NConvert.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Silvio » Sun Jun 18, 2006 8:30 pm

sai per caso se Infarview ha rilasciato un activex perchè la mia vecchia versione usa appunto questo programma per la conversione..ehmm..la modifica la fece Marco Turco in verità....
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Silvio » Sun Jun 18, 2006 8:44 pm

Emg,
Ho trovato un sorgente ( cpp e H) per convertire EMF in BMP ma in pratica come potrei usarlo in xharbour ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Silvio » Sun Jun 18, 2006 8:54 pm

e comunque qualcuno mi disse che cio' era possibile usando il GDi+ di windows ..sai niente ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Enrico Maria Giordano » Sun Jun 18, 2006 9:20 pm

L'unica operazione che si potrebbe tentare senza librerie esterne è di fare il play di un WMF o EMF su di una finestra e poi scrivere il contenuto di quella finestra in un file BMP.

Purtroppo non ho nessun esempio al riguardo ma guardati come fa rpreview.prg a fare il play di un metafile e poi salva l'immagine con il metodo SaveToBmp() della finestra. Naturalmente la risoluzione del play deve essere adatta al risultato che vuoi ottenere.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Silvio » Sun Jun 18, 2006 10:13 pm

sto proprio lavorando sulla rpreview....
Ho rimesso a posto una vecchia Utility ( visualizzazione multipagina, salvataggio pagine in formati grafici, salvataggio in excell solo se proveniente dalla classe Report, invio dei file , compressione dei file in zip )
Cmq Ho scritto all'autore di freeimage sperando in un aiuto per la conversione da emf ai vari formati...
purtrppo l'uso dei programmi estermi come appunto irfanview son o troppo pesanti basti pensare che per nconvert bisogna caricare 800 kb...
Si dovrebbepensare a qualcos'altro di piu' leggero e semplice...
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Marco Turco » Wed Jun 21, 2006 2:52 pm

Ecco la funzione di conversione che utilizza gfl.
Devi passargli il file origine, il nome del file destinazione ed il formato da adottare per il nuovo file. Non fare caso al nome dei parametri, io utilizzo questa funzione unicamente per convertire un file bmp generato da scanner in formato jpg ma puoi convertirlo in una moltitudine di formati ed anche utilizzare file di input di formato diverso da bmp.

Considera che la libreria in questione non è utilizzabile a fini commerciali. Per utilizzarla a fini di lucro devi acquistare la versione commerciale (che comunque se ricordo bene ho pagato un centinaio di euro).

Saluti

Marco

PS. Se la tua è solo una necessità di preview, puoi risolverla comunque più agevolmente con Easypreview che prevede tra l'altro anche l'export in pdf. Mentre per l'export in RTF/DOC puoi utilizzare la dll di Amyuni Tecnologies specifica per la conversione EMF->RTF.

#include "Fivewin.ch"


STATIC hLib


FUNCTION convertfile( cWmf, cJpg, cFormatName )

LOCAL oGflLoadParams := OGFLLOADPARAMS()
LOCAL oGflSaveParams := OGFLSAVEPARAMS()
LOCAL oGflFileInfo := OGFLFILEINFO()

LOCAL nGflBitmap := 0

LOCAL nRet

if .not. file(cWmf)
return
endif


hLib = LOADLIB32( "libgfl.dll" )

GFLLIBINIT()

GFLENABLELZW( 1 )

GFLGETDEFPARAMS( oGflLoadParams:cBuffer )

nRet = GFLLOADBMP( cWmf, @nGflBitmap, oGflLoadParams:cBuffer, oGflFileInfo:cBuffer )

GFLFREEFILEINFO( oGflFileInfo:cBuffer )

oGflSaveParams:nFmtIndex = GFLFMTINDEX( cFormatName )
oGflSaveParams:nQuality = 100
oGflSaveParams:nProgress = 1

nRet = GFLSAVEBMP( cJpg, nGflBitmap, oGflSaveParams:cBuffer )

GFLLIBEXIT()

FREELIB32( hLib )

ferase(cWmf)

RETURN NIL


#include "Struct.ch"


STATIC FUNCTION OGFLBITMAP()

LOCAL oGflBitmap

STRUCT oGflBitmap
MEMBER nType AS WORD
MEMBER nOrigin AS WORD
MEMBER nWidth AS LONG
MEMBER nHeight AS LONG
MEMBER nBytesPL AS DWORD
MEMBER nLinePad AS WORD
MEMBER nReserved AS WORD
MEMBER nBytesPP AS BYTE
MEMBER nBitsPC AS BYTE
MEMBER nXDpi AS WORD
MEMBER nYDpi AS WORD
MEMBER nTranspInd AS WORD
MEMBER nClrUsed AS LONG
MEMBER nClrMap AS LONG
MEMBER nData AS LONG
ENDSTRUCT

RETURN oGflBitmap


STATIC FUNCTION OGFLLOADPARAMS()

LOCAL oGflLoadParams

STRUCT oGflLoadParams
MEMBER nFlags AS DWORD
MEMBER nFormatInd AS LONG
MEMBER nImgWant AS LONG
MEMBER nOrigin AS WORD
MEMBER nClrModel AS WORD
MEMBER nLinePad AS DWORD
MEMBER nDefAlpha AS BYTE
MEMBER nReserved1 AS BYTE
MEMBER nReserved2 AS WORD
MEMBER nWidth AS LONG
MEMBER nHeight AS LONG
MEMBER nOffset AS DWORD
MEMBER nChanOrder AS WORD
MEMBER nChanType AS WORD
MEMBER nPcdBase AS WORD
MEMBER nEpsDpi AS WORD
MEMBER nEpsWidth AS LONG
MEMBER nEpsHeight AS LONG
MEMBER nRead AS DWORD
MEMBER nTell AS DWORD
MEMBER nSeek AS DWORD
MEMBER nAlloc AS DWORD
MEMBER nFree AS DWORD
MEMBER nAllocParm AS DWORD
ENDSTRUCT

RETURN oGflLoadParams


STATIC FUNCTION OGFLSAVEPARAMS()

LOCAL oGflSaveParams

STRUCT oGflSaveParams
MEMBER nFlags AS DWORD
MEMBER nFmtIndex AS LONG
MEMBER nCompress AS WORD
MEMBER nQuality AS WORD
MEMBER nCmpLevel AS WORD
MEMBER nInterlacd AS BYTE
MEMBER nProgress AS BYTE
MEMBER nOffset AS DWORD
MEMBER nChanOrder AS WORD
MEMBER nChanType AS WORD
MEMBER nWrite AS DWORD
MEMBER nTell AS DWORD
MEMBER nSeek AS DWORD
MEMBER nAlloc AS DWORD
MEMBER nFree AS DWORD
MEMBER nAllocParm AS DWORD
ENDSTRUCT

RETURN oGflSaveParams


STATIC FUNCTION OGFLFILEINFO()

LOCAL oGflFileInfo

STRUCT oGflFileInfo
MEMBER nType AS WORD
MEMBER nOrigin AS WORD
MEMBER nWidth AS LONG
MEMBER nHeight AS LONG
MEMBER nFormatInd AS LONG
MEMBER cFormtName AS STRING LEN 8
MEMBER cDescriptn AS STRING LEN 64
MEMBER nXDpi AS WORD
MEMBER nYDpi AS WORD
MEMBER nBitsPP AS WORD
MEMBER nPlanes AS WORD
MEMBER nBytesPP AS DWORD
MEMBER nImages AS LONG
MEMBER nFileSize AS DWORD
MEMBER nClrModel AS WORD
MEMBER nCompressn AS WORD
MEMBER cCmpDescrp AS STRING LEN 64
MEMBER nComment AS WORD
MEMBER nReserved AS WORD
MEMBER nComments AS LONG
ENDSTRUCT

RETURN oGflFileInfo


DLL32 FUNCTION GFLLIBINIT() AS LONG;
PASCAL FROM "gflLibraryInit" LIB hLib

DLL32 FUNCTION GFLLIBEXIT() AS VOID;
PASCAL FROM "gflLibraryExit" LIB hLib

DLL32 FUNCTION GFLENABLELZW( nEnable AS LONG ) AS VOID;
PASCAL FROM "gflEnableLZW" LIB hLib

DLL32 FUNCTION GFLGETDEFPARAMS( cLoadParams AS LPSTR ) AS VOID;
PASCAL FROM "gflGetDefaultLoadParams" LIB hLib

DLL32 FUNCTION GFLFREEFILEINFO( cFileInfo AS LPSTR ) AS VOID;
PASCAL FROM "gflFreeFileInformation" LIB hLib

DLL32 FUNCTION GFLLOADBMP( cFileName AS LPSTR, @nBitmap AS PTR, cLoadParams AS LPSTR, cInformation AS LPSTR ) AS LONG;
PASCAL FROM "gflLoadBitmap" LIB hLib

DLL32 FUNCTION GFLSAVEBMP( cFileName AS LPSTR, nBitmap AS LONG, cSaveParams AS LPSTR ) AS LONG;
PASCAL FROM "gflSaveBitmap" LIB hLib

DLL32 FUNCTION GFLFMTINDEX( cFormat AS LPSTR ) AS LONG;
PASCAL FROM "gflGetFormatIndexByName" LIB hLib
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Silvio » Wed Jun 21, 2006 11:02 pm

grazie marco !!!!!!!!!
sto rimettendo in piedi il nostro vecchio rpreview...in xp theme aggiungendogli altre cose semmai te lo invio cosi mi puoi aiutare ...
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Taiwan » Thu Jun 22, 2006 2:54 am

Hello Marco Turco

your solution support EMF->JPG file?
My preview report EMF file.
I want to convert to JPG file.
Work fine?

Regards,

Richard
User avatar
Taiwan
 
Posts: 218
Joined: Fri Oct 07, 2005 1:55 am
Location: Taipei, Taiwan

Postby Silvio » Thu Jun 22, 2006 7:20 am

Also My Preview report converte to any graphics format :
you can use it if you have Irfanview program
Now you can show multipreview : one page,two page,four page,six page... in a window
Now you can go to page selected.
i'm working to insert many features...

Regards
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Silvio » Thu Jun 22, 2006 11:13 pm

in Amyuni Tecnologies
non ho trovato niente del tipo Emf->rtf
mi dici il link preciso
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Marco Turco » Mon Jun 26, 2006 7:44 am

To Richard:
Yes, EMF to JPG conversion is supported as I know. However a readme file with all formats supported is provided with that library.

To Silvio:
Per quanto riguarda Amyuni mi riferivo alla possibilità di convertire un file EMF in RTF (apribile e modificabile tramite Word quindi). Per fare questo devi scaricare RTF converter. Per la conversione EMF->JPG puoi semplicemente utilizzare la routine del mio precedente messaggio.

Best Regards,

Marco Turco
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Silvio » Mon Jun 26, 2006 7:53 am

Adesso abbiamo il supporto degli activex ... è sicuro che non possiamo trovare *qualcosa* adatto alle nostre esigenze per convertire indolore i file emf negli svariati formati grafic oltre al DOc di WOrd, Pdf ed altri ?
Se usiamo programmi esterni siamo al punto da capo e la memoria molto spesso ci lascia : dobbiamo trovare qualcosa da inserire nei nostri object
o richiamabili come librerie esterne ( DLL)
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Enrico Maria Giordano » Mon Jun 26, 2006 10:32 am

Purtroppo almeno fino a Windows XP non c'è supporto nativo né per i PDF né per i DOC. Non so per Windows Vista.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to All products support

Who is online

Users browsing this forum: No registered users and 11 guests