FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Problema exportando a PDF desde Preview
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problema exportando a PDF desde Preview
Posted: Mon Sep 02, 2013 02: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 (fw): Select all Collapse
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
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Problema exportando a PDF desde Preview
Posted: Mon Sep 02, 2013 03: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 (fw): Select all Collapse
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
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Problema exportando a PDF desde Preview
Posted: Mon Sep 02, 2013 04:07 PM
Antonio, he localizado la l铆nea que genera el error dentro de DibToStr :

Code (fw): Select all Collapse
bmf.bfOffBits 聽 = sizeof( bmf ) + ( LONG ) Bits 聽- ( LONG ) Info;


Concretamente en
Code (fw): Select all Collapse
( 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
Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Problema exportando a PDF desde Preview
Posted: Thu Sep 05, 2013 07:24 AM

Up! :D

Angel Salom
Visionwin Software - https://www.visionwin.com
------------------------------------------------------------
fwh 19.05 - harbour 3.2 - bcc 7.4
Posts: 109
Joined: Mon Apr 30, 2012 09:10 AM
Re: Problema exportando a PDF desde Preview
Posted: 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?.

Posts: 728
Joined: Fri Oct 07, 2005 07:38 AM
Re: Problema exportando a PDF desde Preview
Posted: 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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problema exportando a PDF desde Preview
Posted: Tue Oct 08, 2013 04:52 PM
El error deber铆a quedar solucionado con este arreglo que ya se incluy贸 en FWH:

Code (fw): Select all Collapse
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

Continue the discussion