Hi all,
I am trying to display a pdf with awolepdfxc
.
I load the file as follows:
THISFORM.OlepDF.Tag = "Temp\Test1.pdf"
Blank screen.
I had tried before with an absolute path:
THISFORM.OlepDF.Tag = "C:\Temporaire\Test1.pdf"
Not better with:
THISFORM.OlepDF.Tag = filetostr ("C:\Temporaire\Test1.pdf")
Tag and Visible
are saved.
What did i miss?
Thank you in advance
Bonjour Vincent awolepdfxc's classe need PDFXChanger-viewer (from Trackers Software), installed on the pc to be used..
Cordialement Gilles
Merci Gilles !
But it seems to me that it is installed by default with FIC.
Bonjour Vincent,
PDF-XChange Viewer is not installed by FoxInCloud, only the class to be used with the PDF-XChange active-X..
I use an old PDF-XChange Viewer, but you can download the new one in http://www.pdfxchange.fr/
Cordialement Gilles
Bonjour Gilles,
Thanks for your new response.
It all seems a bit old to me and I wonder if it's not better to use the <embed>
tag
Hi Vincent,
You may want to set a breakpoint in awOLEPDFxc.tag_assign()
and share what happens.
I suspect your file either can't be found or is invalid.
Thanks Thierry,
I prefer this way. Here is the result:
What do you think about ?
looks nice! do you want to share your code?
It's very simple (I just added wcSCR in my class):
TEXT TO THIS.wcHTML TEXTMERGE NOSHOW FLAGS 1 PRETEXT 3
<div class="embed-responsive embed-responsive-4by3" id="<<THIS.wcID>>">
<iframe class="embed-responsive-item" src="<<THIS.wcSCR>>"></iframe>
</div>
ENDTEXT
cool, thanks for sharing!
For safety reasons, make sure that the PDF in the site's temp
folder has a unique name (different across users)
OK, thanks Thierry
Hello! That sounds pretty interesting to me. What do I need to do to deploy this? Use awolpdfxc class?
Thanks!
Hi Arcadio,
No, just the simple code above.
Yes that I understood. But like where did you set the PDF? Which FIC classes did you use?
Thanks!
No classe.
Just (relative) path:
scr="temp/my_pdf_file.pdf"
You only need to copy your file to temp folder, with unique name as Thierry reminds us
Hi Vincent I tried to use your method of viewing a PDF. I have:
- added in an form an OLE object based on the awOLEIE class
- added the following code in the wcGenHTML method of this object
LPARAMETERS toHTMLgen AS awHTMLgen OF awHTML.prg, tlInnerHTML && {en} doc in Parent Code {fr} doc in parent code
WITH m.THIS
TEXT TO .wcHTML TEXTMERGE NOSHOW FLAGS 1 PRETEXT 3
<div class = "embed-responsive embed-responsive-4by3" id = "<<. wcID >>">
<iframe class = "embed-responsive-item" src = "<< m.THISFORM.cFilePDF >>"> </iframe>
</ Div>
endText
ENDWITH
- added in the INIT () method of the form the following code which assigns the name of the PDF file to display to the THISFORM.cFilePDF property
LPARAMETERS p_file AS STRING, p_message AS STRING
=DODEFAULT()
IF VARTYPE(m.p_file) == 'C' AND NOT EMPTY(m.p_file) AND FILE(m.p_file)
* Si l'adresse du fichier change
THISFORM.cFilePdf = m.p_file
IF VARTYPE(m.p_message) == 'C' AND NOT EMPTY(m.p_message)
=THISFORM.wMessageBox('', m.p_message, 64, 'Informations', 10000)
ENDIF
ENDIF
But the PDF does not appear in the form ?? What did I forget to do?
D'avance merci Vincent.. Cordialement
Hi Gilles,
this answer may help you
Bonjour Thierry,
local lcFile, lcFile_
lcFile = 'myReport_' + thisForm.wcUserID + '.pdf'`
lcFile_ = addbs (thisForm.woConfig.cTempPathPhysical) + m.lcFile
&& build m.lcFile_
this.wcScr = thisForm.woConfig.cTempPathVirtual + m.lcFile + '?' + sys (2015)
What is m.lcFile_ used for? (in this.wcScr = thisForm.woConfig.cTempPathVirtual + m.lcFile + '?' + sys (2015) m.lcFile is used)
In my example if my file in THISFORM.cFilePDF contains a unique file name like _SCREEN.locale + TTOC (DATETIME (), 1) + "order_gw" + ALLTRIM (SUBSTR (SYS (2015), 3, 10)) + TRANSFORM (_VFP.PROCESSID) + '.pdf', what is + '?' + sys (2015) in this.wcScr = thisForm.woConfig.cTempPathVirtual + m.lcFile + '?' + sys (2015)
is it imperative that the PDF file is in the thisForm.woConfig.cTempPathPhysical sub-folder?
should the responsive-embeded.less css classes be copied to the xxx.css file?
Amicalement Gilles
What is m.lcFile_ used for? (in this.wcScr = thisForm.woConfig.cTempPathVirtual + m.lcFile + '?' + sys (2015) m.lcFile is used)
In my code sample m.lcFile_
holds fullpath(m.lcFile)
. It is the address you'll build the file into.
what is
+ '?' + sys (2015)
inthis.wcScr = thisForm.woConfig.cTempPathVirtual + m.lcFile + '?' + sys (2015)
If you always use the same name for the same file and user, '?' + sys (2015)
makes sure the browser will reload the file from the server rather than from its cache.
is it imperative that the PDF file is in the thisForm.woConfig.cTempPathPhysical sub-folder?
thisForm.woConfig.cTempPathPhysical
is the physical path for the site's Temp/
directory; so if you want to serve the file from the site's temp folder, you need to store it into thisForm.woConfig.cTempPathPhysical
should the responsive-embeded.less css classes be copied to the xxx.css file?
Vincent may know better than me … I would say no, these classes are defined in bootstrap.css
; you can search the class names in this file.
Hi Gilles,
I confirm, it's not necessary to copy anything in your xxx.css file.
But this parameter is useful for the layout (height):
#yourform_scx .embed-responsive-4by3 {
padding-bottom: xx%;
}
Bien cordialement,
Vincent
Hi Vincent and Thierry,
After many tests here is what I found:
The name of the PDF file displayed using the OLE-IE object and the OLE-IE.wcHTMLGen () method cannot be changed by programming.
It should always be the same ..
Whenever I have modified the value of OLE-IE.wcSRC from a form method to change the name of the PDF, the display in iFrame remains that of the PDF declared in the OLE-IE.wcSRC class.
Using the wcHTMLGen method of an OLE-IE object to display a PDF in an iFRAME on a form seem to be a good idea.
BUT, the wcSRC property added in the class of the OLE-IE object which is used to store the WEB path of the PDF file to display, cannot be modified from a method of the form (for example form.init ()) which has this object OLE-IE
.. even by indicating in the class of the OLE-IE object wcPropSave = 'wcSRC' to allow FIC to save / restore the value of OLE-IE.wcSRC ..
This therefore implies that the PDF file to be displayed in Iframe always has the same name.
What did i miss?
What did I forget to do?
D'avance merci.. Cordialement
Hi Gilles,
I think it's simpler.
In an editbox
control, just add a property named wcSCR and:
wcHTMLgen()
LPARAMETERS toHTMLgen AS awHTMLgen OF awHTML.prg, tlInnerHTML && {en} doc in Parent Code {fr} doc dans le code parent
*!* <div class="embed-responsive embed-responsive-16by9">
*!* <iframe class="embed-responsive-item" src="https://www.youtube.com/embed/zpOULjyy-n8?rel=0" allowfullscreen></iframe>
*!* </div>
WITH THIS
TEXT TO .wcHTML TEXTMERGE NOSHOW FLAGS 1 PRETEXT 3
<div class="embed-responsive embed-responsive-4by3" id="<<.wcID>>">
<iframe class="embed-responsive-item" src="<<.wcSCR>>?<<SYS(2015)>>"></iframe>
</div>
ENDTEXT
ENDWITH
Refresh_()
lparameters void_parameter_reminder_implement_your_Refresh_code_in_this_method
IF EMPTY (THIS.wcID)
RETURN
ENDIF
WITH THISFORM
IF .wBSlHTMLgen
THIS.wcHTMLgen
.wcScriptJSadd(TEXTMERGE([jQuery('#<<THIS.wcID>>').html(<<cLitteralJS(THIS.wcHTML)>>);]))
ENDIF
ENDWITH
Bien à toi, Vincent
Thank you Vincent,
I was missing the JS/HTML script refresh logic ..
thisForm.woConfig.cTempPathPhysical generates an error code when I want to use it to deposit my PDF file in the temporary directory of the site.
'index_scx.my_cntslogan.btnconnect.Clickinet ()': Method or procedure init (): error n ° 1925 ("Unknown member WOCONFIG") in line n ° 16 ("cCopie = ADDBS (thisForm.woConfig.cTempPathPhysical) +" PDFOLEIE.pdf "")
How do you use this directory to store your files?
Encore merci!
For example, with a control using my class:
.Embed.Refresh()
LOCAL oServer as xxxServer OF xxxServer.prg, oConfig as xxxAppConfig OF xxxServer.prg, Mfichier
wlWeb(@m.oServer, @m.oConfig)
Mfichier = "\My_path\Fichier.pdf"
COPY FILE (m.Mfichier) TO ADDBS (m.oConfig.cTempPathPhysical) + "Fichier_Numero_dossier.pdf"
THIS.wcSCR = "temp/Fichier_Numero_dossier.pdf"
DODEFAULT()
A charge de revanche ...
Merci,
Excellent!
A charge de revanche!