kapiaba Posted January 16, 2018 Report Share Posted January 16, 2018 Gerar arquivo em BASE64 - By Marcio Ferreira. Skype: live:xtsystem #include "fivewin.ch" FUNCTION Main() Local cfilein,cfileout,tag51 cfilein :='C:\TESTE\IMAGEM.PDF.P7S' cFileOut :='BASE64.TXT' if !file(cfilein) msginfo('Arquivo: '+CRLF+CRLF+cfilein+CRLF+CRLF+; 'não encontrado...','Atenção' ) exit endif hb_base64encodefile( cfilein , cfileout ) nHandle := fOpen( cfileout ) HB_FreadLine( nHandle, @tag51 ) fclose( nHandle ) ferase( nhandle ) dbselectarea(ofilexml) oFilexml:AppendLn( ' <imagem>' ) oFilexml:AppendLn( ' <protocolo>'+strzero(ARQUIVO->protocolo,10)+'</protocolo>' ) oFilexml:AppendLn( ' <data_protocolo>'+dtoc(ARQUIVO->data_ent)+'</data_protocolo>' ) oFilexml:AppendLn( ' <base64>'+tag51+'</base64>' ) oFilexml:AppendLn( ' </imagem>' ) // tem que incluir a TIP.LIB /* monto um relatorio, gero a imagem pelo pdfcreator gerando um PDF. Depois assino este arquivo com um assinador qualquer. Ai depois converto em base64 Márcio Ferreira - Dúvidas, chama-lo Skype. kkkkkkkkkkkkkkkk - num SAY() de nada. Skype: live:xtsystem */ RETURN NIL Quote Link to comment Share on other sites More sharing options...
Van Posted March 29, 2019 Report Share Posted March 29, 2019 Boa tarde ! Tentei usar essa rotina para codificar um arquivo PDF em base64 e já na compilação deu o erro: Error: Unresolved external '_hb_retc_null' referenced from C:\Empresa\SISTEMAS\LIB\TIP.LIB|base64 Alguma idéia de como resolver esse erro na compilação ? Grata. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted March 29, 2019 Author Report Share Posted March 29, 2019 Bem vinda Van, informe a versão do FWH y de [x]Harbour. Eu acho, que a sua TIP.LIB , esta obsoleta. Se sim, atualize o seu FWH para a versão mais recente com o Gilmer Tavares. Abs. Quote Link to comment Share on other sites More sharing options...
giovanyvecchi Posted April 1, 2019 Report Share Posted April 1, 2019 Inclua a função #pragma BEGINDUMP #include <hbapi.h> #include <windows.h> #include <ShellApi.h> #include <ShlObj.h> ///#include "hbapi.h" typedef LONG ( * PDLLREGISTERSERVER ) ( void ); HB_FUNC( HB_BASE64ENCODE ) { ULONG len = hb_parclen( 1 ); if( len <= INT_MAX ) /* TOFIX */ { const char * s = hb_parcx( 1 ); char * t, * p; t = p = ( char * ) hb_xgrab( ( 4 * ( ( len + 2 ) / 3 ) + 1 ) * sizeof( *t ) ); while( len-- > 0 ) { static const char s_b64chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int x, y; x = *s++; *p++ = s_b64chars[ ( x >> 2 ) & 0x3F ]; if( len-- <= 0 ) { *p++ = s_b64chars[ ( x << 4 ) & 0x3F ]; *p++ = '='; *p++ = '='; break; } y = *s++; *p++ = s_b64chars[ ( ( x << 4 ) | ( ( y >> 4 ) & 0x0F ) ) & 0x3F ]; if( len-- <= 0 ) { *p++ = s_b64chars[ ( y << 2 ) & 0x3F ]; *p++ = '='; break; } x = *s++; *p++ = s_b64chars[ ( ( y << 2 ) | ( ( x >> 6 ) & 3 ) ) & 0x3F ]; *p++ = s_b64chars[ x & 0x3F ]; } *p = '\0'; hb_retc_buffer( t ); } else hb_retc_null(); } #pragma ENDDUMP Quote Link to comment Share on other sites More sharing options...
Van Posted April 1, 2019 Report Share Posted April 1, 2019 Amigos, obrigada... atualizei a TIP.LIB e consegui fazer a conversão corretamente. Vocês são ótimos... muito grata... kapiaba 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.