Problems with Preview
Problems with Preview
I'm having problems saving a Previewed document as a PDF file when running my application using a Remote Desktop Connection. No matter what I do it won't save the document as a PDF, even if I choose the Print option and pick a PDF writer as the printer. I suspect it has to do with where the meta file created by the Preview function is stored, although thats just a hunch. Is there any way to tell the Preview function where to store the meta files, or is there some other solution I'm missing?
- Silvio.Falconi
- Posts: 7110
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Problems with Preview
you tried to delete the temp files because Rpreview saves the files starting with w and wmf or emf in a windows folder
you can set the folder change the function FWSavePreviewToPDF( oPreview, cPDF, lOpen ) you found on Prev2Pdf.prg
I use this
function FWSavePreviewToPDF( oPreview, cPDF, lOpen )
local cOrient, oPDF
local n
cPdf:= oApp:cPdfTemp
if LoadFreeImage() <= 32
MsgAlert( "Freeimage.dll non trovata" )
return nil
endif
DEFAULT cPDF := cGetFile( "PDF File (*.pdf)|*.pdf|", "Seleziona il File PDF da Save", ;
CurDir(), .t. )
....
you can set the folder change the function FWSavePreviewToPDF( oPreview, cPDF, lOpen ) you found on Prev2Pdf.prg
I use this
function FWSavePreviewToPDF( oPreview, cPDF, lOpen )
local cOrient, oPDF
local n
cPdf:= oApp:cPdfTemp
if LoadFreeImage() <= 32
MsgAlert( "Freeimage.dll non trovata" )
return nil
endif
DEFAULT cPDF := cGetFile( "PDF File (*.pdf)|*.pdf|", "Seleziona il File PDF da Save", ;
CurDir(), .t. )
....
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
- Antonio Linares
- Site Admin
- Posts: 42393
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 9 times
- Been thanked: 41 times
- Contact:
Re: Problems with Preview
Dear David,
I guess Silvio simply specifies a different path:
instead of cPdf:= oApp:cPdfTemp
use cPdf := "the_path"
I guess Silvio simply specifies a different path:
instead of cPdf:= oApp:cPdfTemp
use cPdf := "the_path"
- Silvio.Falconi
- Posts: 7110
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Problems with Preview
oApp Is Mine....make as Antonio wrote but U must recompile with your application that function U found on fwh source/functions folderdtussman wrote:Thanks Silvio. Tried that but it won't compile, doesn't recognize oApp
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Re: Problems with Preview
I'm not sure i've described the problem correctly. When connected to my application using windows Remote Desktop Connection, if I preview a document and then click the button to save as a PDF it saves the document but all the pages are blank. It works fine when not using Remote Desktop Connection.
- Antonio Linares
- Site Admin
- Posts: 42393
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 9 times
- Been thanked: 41 times
- Contact:
Re: Problems with Preview
Dear David,
I have built FWH\samples\testprn2.prg and then copied the EXE to a remote PC managed with remote desktop.
The preview is properly shown and if I export it to PDF, the PDF is properly seen. Could you please reproduce my test ?
Here you have a screenshot of my test: (click on the url to see the entire screenshot)
https://github.com/FiveTechSoft/screens ... g?raw=true
thanks
I have built FWH\samples\testprn2.prg and then copied the EXE to a remote PC managed with remote desktop.
The preview is properly shown and if I export it to PDF, the PDF is properly seen. Could you please reproduce my test ?
Here you have a screenshot of my test: (click on the url to see the entire screenshot)
https://github.com/FiveTechSoft/screens ... g?raw=true
thanks
- karinha
- Posts: 7910
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Problems with Preview
I do like this:
Regards, saludos.
Code: Select all | Expand
FUNCTION Main()
PRIVATE cDirPleno := GETCURDIR()
RETURNÿNIL
function FWSavePreviewToPDF( oDevice, cPDF, lOpen ) // oDevice can be oPrinter or oPreview
local cOrient, oPDF, cPRGPATH
local hWnd
if oDevice:IsKindOf( "TPREVIEW" )
hWnd := oDevice:oWnd:hWnd
oDevice := oDevice:oDevice
endif
#ifndef USEGDI
if LoadFreeImage() <= 32
MsgAlert( FWString( "freeimage.dll not found" ), FWString( "Alert" ) )
return nil
endif
#endif
PRIVATE CDIRPLENO
// AQUI
cPRGPATH := cFILEPATH( "C:\NFEPDF\" )
lCHDIR(cPRGPATH) // AQUI
// ? hb_CurDrive() + ":\" + CurDir() + "\"
DEFAULT cPDF := cGetFile( FWString( "PDF files | *.pdf |" ),;
FWString( "Select PDF File to Save" ),, ;
CurDir(), .T.,,,;
hb_CurDrive() + ":\" + CurDir() + "\" + ;
If( oDevice:IsKindOf( "TPreview" ),;
oDevice:cName, oDevice:cDocument ) + ".pdf" )
if ! Empty( cPDF )
cPDF = cFileSetExt( cPDF, "pdf" )
CursorWait()
cOrient = If( oDevice:nHorzSize() > oDevice:nVertSize(), 'L', 'P' )
oPdf = fwPdf():New( cPdf, cOrient )
AEval( oDevice:aMeta, { | cMeta | oPdf:AddMeta( cMeta ) } )
oPdf:Close()
CursorArrow()
DEFAULT lOpen := MsgYesNo( If( FWLanguageID() == 2, FWString( "¿" ) + " ", "" ) + ;
FWString( "View" ) + ;
" " + cPDF + " " + FWString( "(Y/N)" ) + " ?",;
FWString( "Please select" ) )
if lOpen
ShellExecute( IfNil( hWnd, GetWndDefault() ), "open", cPDF )
endif
else
cPDF := nil
endif
// RETURN TO MASTER - // AQUI
lCHDIR( cDirPleno )
// ? hb_CurDrive() + ":\" + CurDir() + "\"
return cPDF
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- Otto
- Posts: 6396
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 8 times
- Been thanked: 1 time
- Contact:
Re: Problems with Preview
Hello Silvio,
sure no rights on the RDP server where you save the preview.
Best regards,
Otto
sure no rights on the RDP server where you save the preview.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Otto
- Posts: 6396
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 8 times
- Been thanked: 1 time
- Contact:
Re: Problems with Preview
... you need read/write for RemoteDesktopUser
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Silvio.Falconi
- Posts: 7110
- Joined: Thu Oct 18, 2012 7:17 pm
Re: Problems with Preview
I not must print from remoteOtto wrote:Hello Silvio,
sure no rights on the RDP server where you save the preview.
Best regards,
Otto
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Re: Problems with Preview
Hello Antonio,
I compiled and ran your testprn2.prg i and the preview displays the nice pattern of plus signs but the pdf only displays 2 blank pages. As I said before I suspect it has something to do with the application not being able to access the preview temp files or images (I'm not sure exactly what form they are in) which I assume its trying to store on the remote server. I'm running the app on a remote server, not just on another computer.
Regards,
David
I compiled and ran your testprn2.prg i and the preview displays the nice pattern of plus signs but the pdf only displays 2 blank pages. As I said before I suspect it has something to do with the application not being able to access the preview temp files or images (I'm not sure exactly what form they are in) which I assume its trying to store on the remote server. I'm running the app on a remote server, not just on another computer.
Regards,
David
- Antonio Linares
- Site Admin
- Posts: 42393
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 9 times
- Been thanked: 41 times
- Contact:
Re: Problems with Preview
Dear David,
Please check these values remotely:
MsgInfo( GetEnv( "TEMP" ) )
MsgInfo( GetEnv( "TMP" ) )
MsgInfo( GetWinDir() )
MsgInfo( oPrinter:cDir ) will tell you which one is in use
as this is the code where the preview sets the temporary folder:
Check what they return and if you have write access there
Please check these values remotely:
MsgInfo( GetEnv( "TEMP" ) )
MsgInfo( GetEnv( "TMP" ) )
MsgInfo( GetWinDir() )
MsgInfo( oPrinter:cDir ) will tell you which one is in use
as this is the code where the preview sets the temporary folder:
Code: Select all | Expand
::cDir = GetEnv( "TEMP" )
if Empty( ::cDir )
::cDir = GetEnv( "TMP" )
endif
if Right( ::cDir, 1 ) == "\"
::cDir = SubStr( ::cDir, 1, Len( ::cDir ) - 1 )
endif
if ! Empty( ::cDir )
if ! lIsDir( ::cDir )
::cDir = GetWinDir()
endif
else
::cDir := GetWinDir()
endif
- Otto
- Posts: 6396
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 8 times
- Been thanked: 1 time
- Contact:
Re: Problems with Preview
Dear Antonio,
We found out, that on some WINDOWS version you have to create the TEMP DIR yourself.
Best regards,
Otto
We found out, that on some WINDOWS version you have to create the TEMP DIR yourself.
Best regards,
Otto
Code: Select all | Expand
local cUmgebungTMP := GETENV("TMP")
*----------------------------------------------------------
if lIsDir( cUmgebungTMP ) = .f.
? "TEMP DIR erstellen " + cUmgebungTMP
lMKDir( cUmgebungTMP )
endif
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Re: Problems with Preview
Hi Antonio,
Both the TEMP and TMP variables were a strange folder that doesn't even exist and that was also the oprinter:cdir folder. So I created my own temp folder and changed oprinter:cdir to that folder. When running your sample code 2 emf files appeared in that folder, but when converting to pdf I still get the same result, 2 blank pages.
Both the TEMP and TMP variables were a strange folder that doesn't even exist and that was also the oprinter:cdir folder. So I created my own temp folder and changed oprinter:cdir to that folder. When running your sample code 2 emf files appeared in that folder, but when converting to pdf I still get the same result, 2 blank pages.