Problema exportando a PDF desde Preview

Re: Problema exportando a PDF desde Preview

Postby Antonio Linares » Mon Sep 02, 2013 2:51 pm

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;
}
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Problema exportando a PDF desde Preview

Postby AngelSalom » Mon Sep 02, 2013 3:34 pm

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.
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Problema exportando a PDF desde Preview

Postby AngelSalom » Mon Sep 02, 2013 4:07 pm

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).
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Problema exportando a PDF desde Preview

Postby AngelSalom » Thu Sep 05, 2013 7:24 am

Up! :D
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Problema exportando a PDF desde Preview

Postby joseluispalma » Thu Sep 05, 2013 10:02 am

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?.
joseluispalma
 
Posts: 109
Joined: Mon Apr 30, 2012 9:10 am

Re: Problema exportando a PDF desde Preview

Postby AngelSalom » Thu Sep 05, 2013 10:17 am

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
Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
User avatar
AngelSalom
 
Posts: 708
Joined: Fri Oct 07, 2005 7:38 am
Location: Benicarló (Castellón ) - España

Re: Problema exportando a PDF desde Preview

Postby Antonio Linares » Tue Oct 08, 2013 4:52 pm

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 !!!
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Previous

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 49 guests