Page 2 of 2

Re: Problema exportando a PDF desde Preview

PostPosted: Mon Sep 02, 2013 2:51 pm
by Antonio Linares
Angel,

Esta es el código de la función DibToStr() que está en FWH/source/winapi/dib.c

Te agradecería mucho si le pones algunas trazas con MessageBox() y me indicas hasta donde llega antes de generarse el GPF, gracias:

Code: Select all  Expand view
char * DibToStr( HGLOBAL hDib, long * plSize )
{
   LPBITMAPINFO Info = ( LPBITMAPINFO ) GlobalLock( hDib );
   void * Bits  = ( void * ) ( ( char * ) Info + Info->bmiHeader.biSize +
                    wDIBColors( ( LPBITMAPINFOHEADER ) Info ) * sizeof( RGBQUAD ) );
   BITMAPFILEHEADER bmf;
   char * pDib;
   long lSize;

   lSize = GlobalSize( ( HGLOBAL ) Info );
   MessageBox( 0, "1", "ok", MB_ICONINFORMATION );

   pDib = ( char * ) hb_xgrab( sizeof( bmf ) + lSize );
   MessageBox( 0, "2", "ok", MB_ICONINFORMATION );

   bmf.bfType      = 0x4D42;
   bmf.bfSize      = sizeof( bmf ) + lSize;
   bmf.bfReserved1 = 0;
   bmf.bfReserved2 = 0;
   bmf.bfOffBits   = sizeof( bmf ) + ( LONG ) Bits - ( LONG ) Info;

   memcpy( pDib, &bmf, sizeof( bmf ) );
   MessageBox( 0, "3", "ok", MB_ICONINFORMATION );
   memcpy( ( char * ) pDib + sizeof( bmf ), ( void * ) Info, lSize );
   MessageBox( 0, "4", "ok", MB_ICONINFORMATION );
   lSize += sizeof( BITMAPFILEHEADER );
   *plSize = lSize;

   return pDib;
}
 

Re: Problema exportando a PDF desde Preview

PostPosted: Mon Sep 02, 2013 3:34 pm
by AngelSalom
Antonio Linares wrote:Angel,

Esta es el código de la función DibToStr() que está en FWH/source/winapi/dib.c

Te agradecería mucho si le pones algunas trazas con MessageBox() y me indicas hasta donde llega antes de generarse el GPF, gracias:

Code: Select all  Expand view
char * DibToStr( HGLOBAL hDib, long * plSize )
{
   LPBITMAPINFO Info = ( LPBITMAPINFO ) GlobalLock( hDib );
   void * Bits  = ( void * ) ( ( char * ) Info + Info->bmiHeader.biSize +
                    wDIBColors( ( LPBITMAPINFOHEADER ) Info ) * sizeof( RGBQUAD ) );
   BITMAPFILEHEADER bmf;
   char * pDib;
   long lSize;

   lSize = GlobalSize( ( HGLOBAL ) Info );
   MessageBox( 0, "1", "ok", MB_ICONINFORMATION );

   pDib = ( char * ) hb_xgrab( sizeof( bmf ) + lSize );
   MessageBox( 0, "2", "ok", MB_ICONINFORMATION );

   bmf.bfType      = 0x4D42;
   bmf.bfSize      = sizeof( bmf ) + lSize;
   bmf.bfReserved1 = 0;
   bmf.bfReserved2 = 0;
   bmf.bfOffBits   = sizeof( bmf ) + ( LONG ) Bits - ( LONG ) Info;

   memcpy( pDib, &bmf, sizeof( bmf ) );
   MessageBox( 0, "3", "ok", MB_ICONINFORMATION );
   memcpy( ( char * ) pDib + sizeof( bmf ), ( void * ) Info, lSize );
   MessageBox( 0, "4", "ok", MB_ICONINFORMATION );
   lSize += sizeof( BITMAPFILEHEADER );
   *plSize = lSize;

   return pDib;
}
 


Me pongo a ello y te digo.

Re: Problema exportando a PDF desde Preview

PostPosted: Mon Sep 02, 2013 4:07 pm
by AngelSalom
Antonio, he localizado la línea que genera el error dentro de DibToStr :

Code: Select all  Expand view
bmf.bfOffBits   = sizeof( bmf ) + ( LONG ) Bits  - ( LONG ) Info;


Concretamente en
Code: Select all  Expand view
( LONG ) Bits


Comentando esta línea ó eliminando esa porción de código la función no da error (aunque genera el pdf en blanco).

Re: Problema exportando a PDF desde Preview

PostPosted: Thu Sep 05, 2013 7:24 am
by AngelSalom
Up! :D

Re: Problema exportando a PDF desde Preview

PostPosted: Thu Sep 05, 2013 10:02 am
by joseluispalma
Entonces, ¿no está operativa la exportación de PDFS con las funciones nativas de FWH?.

Uso image2pdf.dll, pero también a veces las fuentes no las coge bien.

¿Se sabe algo de las nuevas actualizaciones de Fivewin?.

Re: Problema exportando a PDF desde Preview

PostPosted: Thu Sep 05, 2013 10:17 am
by AngelSalom
joseluispalma wrote:Entonces, ¿no está operativa la exportación de PDFS con las funciones nativas de FWH?.

Uso image2pdf.dll, pero también a veces las fuentes no las coge bien.

¿Se sabe algo de las nuevas actualizaciones de Fivewin?.


Jose Luis, a mí me da problemas en algunas ocasiones y dependiendo del sistema operativo.
Actualmente tengo la versión de FWH 12.04

Re: Problema exportando a PDF desde Preview

PostPosted: Tue Oct 08, 2013 4:52 pm
by Antonio Linares
El error debería quedar solucionado con este arreglo que ya se incluyó en FWH:

Code: Select all  Expand view
HB_FUNC( DIBTOSTR )  // ( hDib ) --> lSuccess
{
   long lSize;
   char * pDib;

   #ifndef _WIN64
      pDib = DibToStr( ( HGLOBAL ) hb_parnl( 1 ), &lSize );
   #else  
      pDib = DibToStr( ( HGLOBAL ) hb_parnll( 1 ), &lSize );
   #endif

   hb_retclen( pDib, lSize );
   hb_xfree( ( void * ) pDib ); // aqui !!!
}