FWSavePreviewToPDF 32-bit vs. 64-bit
- don lowenstein
- Posts: 196
- Joined: Mon Oct 17, 2005 9:09 pm
- Contact:
FWSavePreviewToPDF 32-bit vs. 64-bit
I use FWSavePreviewToPDF to create .PDF files
using FWH 32-bit version I can copy/paste text from the output.
using FWH 64-bit version COMPILING SAME EXACT CODE, I can not copy/paste text from the output. I can only copy an image section of the .PDF.
what can I do so that the 64-bit FWH allows me to copy / paste the pdf information as text?
using FWH 32-bit version I can copy/paste text from the output.
using FWH 64-bit version COMPILING SAME EXACT CODE, I can not copy/paste text from the output. I can only copy an image section of the .PDF.
what can I do so that the 64-bit FWH allows me to copy / paste the pdf information as text?
Don Lowenstein
www.laapc.com
www.laapc.com
- don lowenstein
- Posts: 196
- Joined: Mon Oct 17, 2005 9:09 pm
- Contact:
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
Correction - I use a different library for 32-bit PDF files.
therefore, my question is, how can I create FWH pdf file that allows the text to be copy/paste as text and not an image?
therefore, my question is, how can I create FWH pdf file that allows the text to be copy/paste as text and not an image?
Don Lowenstein
www.laapc.com
www.laapc.com
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
Not possible with FWSavePreviewToPDF .don lowenstein wrote:Correction - I use a different library for 32-bit PDF files.
therefore, my question is, how can I create FWH pdf file that allows the text to be copy/paste as text and not an image?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- don lowenstein
- Posts: 196
- Joined: Mon Oct 17, 2005 9:09 pm
- Contact:
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
If I choose to preview the file first using the FWH preview, then click the "Save to PDF" button, I can indeed copy / paste text.
I don't see why the button on the report-preview screen from FWH will allow the copy / paste of text.
I don't see why the button on the report-preview screen from FWH will allow the copy / paste of text.
Don Lowenstein
www.laapc.com
www.laapc.com
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
Don,
> Correction - I use a different library for 32-bit PDF files
Can't you get a 64 bits version of such library ?
> Correction - I use a different library for 32-bit PDF files
Can't you get a 64 bits version of such library ?
-
- Posts: 988
- Joined: Thu Nov 24, 2005 3:01 pm
- Location: Madrid, España
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
Hi Don
The only one i know is PdfToImage.dll, but it has several issues related to fonts handling, and in some cases the conversion was far from accurate.
Carlos
What are you iusing in 32 bits to generate regular (no images) pdfs?don lowenstein wrote:Correction - I use a different library for 32-bit PDF files.
therefore, my question is, how can I create FWH pdf file that allows the text to be copy/paste as text and not an image?
The only one i know is PdfToImage.dll, but it has several issues related to fonts handling, and in some cases the conversion was far from accurate.
Carlos
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
- don lowenstein
- Posts: 196
- Joined: Mon Oct 17, 2005 9:09 pm
- Contact:
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
clicking on the Export to PDF from the FiveWin previewer produces on that can be copy/pasted as text.
how does that happen?
how does that happen?
Don Lowenstein
www.laapc.com
www.laapc.com
- don lowenstein
- Posts: 196
- Joined: Mon Oct 17, 2005 9:09 pm
- Contact:
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
I used Image2pdf.dll from utility warrior.
it is a 32-bit library and I can't seem to find this vendor anymore.
it is a 32-bit library and I can't seem to find this vendor anymore.
Don Lowenstein
www.laapc.com
www.laapc.com
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
Don,
> clicking on the Export to PDF from the FiveWin previewer produces on that can be copy/pasted as text
Not sure if we can call the button function directly
We are checking it
> clicking on the Export to PDF from the FiveWin previewer produces on that can be copy/pasted as text
Not sure if we can call the button function directly
We are checking it
- don lowenstein
- Posts: 196
- Joined: Mon Oct 17, 2005 9:09 pm
- Contact:
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
FWSavePreviewToPDF is called by that button using a TPreview object I believe.
Don Lowenstein
www.laapc.com
www.laapc.com
- don lowenstein
- Posts: 196
- Joined: Mon Oct 17, 2005 9:09 pm
- Contact:
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
HB_FUNC( GDIPLUSEMFTOJPG )
this function is used by FWSavePreviewToPDF to create a jpeg file.
for some reason the file created by DDIPLUSEMFTOJPG contains a file extension of JPEG followed by Chinese-looking characters.
LPWSTR filefin = ( LPWSTR ) hb_parc( 3 );
CLSID cClsid ;
CLSIDFromString( L"{557CF401-1A04-11D3-9A73-0000F81EF32E}" , &cClsid ) ;
newImage->Save( filefin , &cClsid, &encoderParameters );
the FErase commmand does not work on these files with the "unusual" extension.
where does the unusual extension come from?
these odd files accumulate and don't get deleted by FErase.
this function is used by FWSavePreviewToPDF to create a jpeg file.
for some reason the file created by DDIPLUSEMFTOJPG contains a file extension of JPEG followed by Chinese-looking characters.
LPWSTR filefin = ( LPWSTR ) hb_parc( 3 );
CLSID cClsid ;
CLSIDFromString( L"{557CF401-1A04-11D3-9A73-0000F81EF32E}" , &cClsid ) ;
newImage->Save( filefin , &cClsid, &encoderParameters );
the FErase commmand does not work on these files with the "unusual" extension.
where does the unusual extension come from?
these odd files accumulate and don't get deleted by FErase.
Don Lowenstein
www.laapc.com
www.laapc.com
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
We will look into this issue.don lowenstein wrote:HB_FUNC( GDIPLUSEMFTOJPG )
this function is used by FWSavePreviewToPDF to create a jpeg file.
for some reason the file created by DDIPLUSEMFTOJPG contains a file extension of JPEG followed by Chinese-looking characters.
LPWSTR filefin = ( LPWSTR ) hb_parc( 3 );
CLSID cClsid ;
CLSIDFromString( L"{557CF401-1A04-11D3-9A73-0000F81EF32E}" , &cClsid ) ;
newImage->Save( filefin , &cClsid, &encoderParameters );
the FErase commmand does not work on these files with the "unusual" extension.
where does the unusual extension come from?
these odd files accumulate and don't get deleted by FErase.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
Changedon lowenstein wrote:HB_FUNC( GDIPLUSEMFTOJPG )
this function is used by FWSavePreviewToPDF to create a jpeg file.
for some reason the file created by DDIPLUSEMFTOJPG contains a file extension of JPEG followed by Chinese-looking characters.
LPWSTR filefin = ( LPWSTR ) hb_parc( 3 );
CLSID cClsid ;
CLSIDFromString( L"{557CF401-1A04-11D3-9A73-0000F81EF32E}" , &cClsid ) ;
newImage->Save( filefin , &cClsid, &encoderParameters );
the FErase commmand does not work on these files with the "unusual" extension.
where does the unusual extension come from?
these odd files accumulate and don't get deleted by FErase.
LPWSTR filefin = ( LPWSTR ) hb_parc( 3 );
to this :
LPWSTR filefin = AnsiToWide( ( char * ) hb_parc( 3 ) );
-
- Posts: 988
- Joined: Thu Nov 24, 2005 3:01 pm
- Location: Madrid, España
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
I was working for a couple of weeks with the owner of the library to fix several problems related to font identification in EMF records, but with no luck. Several month later the author emailed me an offer to buy the source code, becouse he was closing his software business. That was the last contact I had. Anyway, I wasn't happy with the library results and quit from using it since then.don lowenstein wrote:I used Image2pdf.dll from utility warrior.
it is a 32-bit library and I can't seem to find this vendor anymore.
In the first message you wrote that you were interested in copying text from prds. AFAIK, that cannot be done if the pdf is made of JPGs, unless you use some kind of OCR or so to do the conversion. Am I wrong?
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Re: FWSavePreviewToPDF 32-bit vs. 64-bit
My GdiplusEMFtojpg function is something other than fwh has. Also some changes would have some functions like Emm2Jpeg ,etc .
In my function besides regulating the quality of the image you can regulate the density (important in an impression)
I Put the modified function here (with another name not to mess with us) .
changes in Emf2Jpeg( cEMF )
changes in Tpdf
and changes in FWSavePreviewToPDF
In my function besides regulating the quality of the image you can regulate the density (important in an impression)
I Put the modified function here (with another name not to mess with us) .
Code: Select all
HB_FUNC( GDIP_EMFTOJPG )
{
FILE * fil = fopen ( hb_parc(1) , "rb" ) ;
fseek ( fil , 0 , SEEK_END ) ;
int filesize = ftell ( fil ) ;
fseek ( fil , 0 , SEEK_SET ) ;
HGLOBAL hglobal = GlobalAlloc ( GMEM_MOVEABLE , filesize ) ;
char * adr = (char *)GlobalLock ( hglobal ) ;
int nbytes = fread ( adr , 1 , filesize , fil ) ;
fclose ( fil ) ;
if ( nbytes != filesize )
{
MessageBox( GetActiveWindow(), "fallo", "No carga la imagen", 0x30 );
} ;
LPSTREAM pstm = NULL ;
GlobalUnlock ( hglobal ) ;
CreateStreamOnHGlobal ( hglobal, TRUE, &pstm ) ;
Metafile * original = new Metafile( pstm ) ;
LPWSTR filefin = AnsiToWide( ( char * ) hb_parc( 2 ) );
long quality = hb_parnl(3) ;
double nDensity = hb_parnl(4) ;
int nWidth = original->GetWidth() ;
int nHeight = original->GetHeight() ;
CLSID EncoderQuality ;
double nAlto ;
double nAncho ;
if ( nWidth > nHeight )
{
nAlto = ( 210 * nDensity ) / 25.4 ;
nAncho = ( 297 * nDensity ) / 25.4 ;
}
else
{
nAncho = ( 210 * nDensity) / 25.4 ;
nAlto = ( 297 * nDensity ) / 25.4 ;
}
nHeight = (int) nAlto ;
nWidth = (int) nAncho ;
Bitmap * newImage = new Bitmap(nWidth, nHeight );
newImage->SetResolution( nDensity, nDensity );
Graphics * g = new Graphics( newImage );
g->Clear( Color::White ) ;
g->SetSmoothingMode( SmoothingModeAntiAlias );
g->DrawImage( original,0, 0, nWidth, nHeight);
CLSIDFromString( L"{1D5BE4B5-FA4A-452D-9CDD-5DB35105E7EB}", &EncoderQuality ) ;
EncoderParameters encoderParameters;
encoderParameters.Count = 1;
encoderParameters.Parameter[0].Guid = EncoderQuality ;
encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong;
encoderParameters.Parameter[0].NumberOfValues = 1;
encoderParameters.Parameter[0].Value = &quality ;
CLSID cClsid ;
CLSIDFromString( L"{557CF401-1A04-11D3-9A73-0000F81EF32E}" , &cClsid ) ;
newImage->Save( filefin , &cClsid, &encoderParameters );
delete newImage ;
delete g ;
delete original ;
pstm->Release();
}
Code: Select all
static function Emf2Jpeg( cEMF , nQuality, nDensity )
local cJpeg := cFileSetExt( cEMF, "jpg" )
local hDC1, hDC, hDib, hDib2, hMem, hBmp, hOldBmp, hEMF
local cBuf, oRect, lRet := .f.
local nFormat
DEFAULT nQuality := 100
DEFAULT nDensity := 300
#ifdef USEGDI
if upper(right(cEMF,3)) == "EMF"
GDIP_EMFTOJPG( cEMF , cJpeg , nQuality, nDensity )
endif
cBuf := MemoRead( cJpeg )
#else
cBuf := MemoRead( cEMF )
oRect := TRect():New( 0, 0, Bin2L( SubStr( cBuf, 21, 4 ) ) / 2, ;
Bin2L( SubStr( cBuf, 17, 4 ) ) / 2 )
hEMF := GetEnhMetaFile( cEMF )
hDC1 := GetDC( GetDesktopWindow() )
hDC := CreateCompatibleDC( hDC1 )
hBmp := CreateCompatibleBitmap( hDC1, oRect:nWidth, oRect:nHeight )
hOldBmp := SelectObject( hDC, hBmp )
FillRect( hDC, oRect:aRect, GetStockObject( 0 ) )
PlayEMF( hDC, hEMF, oRect:cRect )
hDib := DibFromBitmap( hBmp )
cBuf := DibToStr( hDib )
GlobalFree( hDib )
// CloseEnhMetafile( hEMF ) // commented out 2014-02-13
DeleteEnhMetafile( hEMF ) // inserted 2014-02-13
SelectObject( hDC, hOldBmp )
DeleteDC( hDC )
DeleteDC( hDC1 )
DeleteObject( hBmp )
hMem := FI_OpenMemory( cBuf, Len( cBuf ) )
nFormat := FI_GetFileTypeFromMemory( hMem, 0 )
hDib := FI_LoadFromMemory( nFormat, hMem, 0 )
cBuf := nil // to release memory
FI_CloseMemory( hMem )
hDib2 := FICnv24( hDib )
FIUnload( hDib )
lRet := FISave( 2, hDib2, cJpeg, JPEG_DEFAULT )
FIUnload( hDib2 )
cBuf := If( lRet, MemoRead( cJpeg ), "" )
#endif
FErase( cJpeg )
return cBuf
Code: Select all
DATA nQuality, nDensity
METHOD New( cFile, cOrient ,nQuality, nDensity ) CLASS FWPDF
DEFAULT cOrient := "P"
DEFAULT nQuality := 50
DEFAULT nDensity := 300
::nQuality := nQuality
::nDensity := nDensity
if cOrient == "P"
::nPageWidth := a4_width
::nPageHeight := a4_height
else
::nPageWidth := a4_height
::nPageHeight := a4_width
endif
::aRefs := { 0, 0 }
::nDocLen := PdfBegin( cFile )
return Self
METHOD AddMeta( cMeta ) CLASS FWPDF
local nAt
::nPage++
::WritePage( Emf2Jpeg( cMeta, ::nQuality, ::nDensity ) )
return Self
Code: Select all
function FWSavePreviewToPDF( oDevice, cPDF, lOpen, nQuality, nDensity ) // oDevice can be oPrinter or oPreview
local cOrient, oPDF
local hWnd
LOCAL aDatos:= {}
DEFAULT nQuality := 50
DEFAULT nDensity := 300
.........
oPdf = fwPdf():New( cPdf, cOrient, nQuality, nDensity )
.......