[Gambas-user] Any (easy) way to render RTF or HTML with gambas?
Fernando Cabral
fernandojosecabral at ...626...
Sun Jul 2 23:17:22 CEST 2017
2017-07-02 17:19 GMT-03:00 Fabien Bodard <gambas.fr at ...626...>:
> Well DocumentView is just a viewer i've done for gb.report. In fact
> it's abilities is to manages different Image in a paging style layout.
>
Starting with you example I have been able to do what I needed. I just
deleted the part that allows the user
to select a PDF file. Instead I put a path/filename as a constant.
Only problem is that I have not found how to change font size. Even so, it
delivers what I needed.
Thank you.
- fernando
>
> So this tool is good for display Documents such as pdf or reports. But
> for those documents the libs pdf and report have a .Draw method that
> render the image in the given DrawingArea or image container.
>
> For you job take a look in the gambas ide in the HelpView.class. It
> inherit webview and give the hability to manage personnal url's. (in
> this case "gambas://") by cheating with the error link event.
>
> Take a look :-). Even we generate web page on the fly for the help
> embedded in the code source.
>
> 2017-07-02 19:11 GMT+02:00 PICCORO McKAY Lenz <mckaygerhard at ...626...>:
> > 2017-07-02 12:12 GMT-04:30 Fernando Cabral <fernandojosecabral at ...626...
> >:
> >
> >> As to this, I think you still did not understand what I needed, which is
> >> to render a HTML or RTF file. This has nothing to do with HTTPD or HTTP.
> >> The RTF and HTLM file are local file. I open them and them I wanted do
> >> display them. No protocols involved.
> >>
> > jajaj Fernando.. the method i described its the same you do.. but you
> using
> > pdf instead html
> >
> > just invoked a "own" localhost running inside project, same behaviour are
> > used by the gambas IDE when you run a WEB project..
> >
> >
> >>
> >>> i prefer the firs due all the hard work to interprete the html markup
> are
> >>> "let to expert".. and not hadle by own.. due will be a extra work..
> >>>
> >>
> >> Yep. That's why I was searching for some built in method to do it.
> >>
> > * Try $hPdf.Open("pdfFIle.pdf")*
> >>
> >>
> >> * DocumentView1.Count = $hPdf.Count DocumentView1.Refresh*
> >>
> > same as for html.. but changing the open call by a httpd run process in
> > private port and send a exec to browser to open the local running httpd
> > "own" webserver
> >
> > the gambas ide do the same for web projects.. rund their own embebed http
> > web server and start a browser..
> >
> > instead use a embebed http webserver you can use the gb.httpd component
> > that does/usage are the same..
> >
> >
> >>
> >> This solves this issue for good, althou I still want to know how to do
> the
> >> same thing with a HTML file.
> >>
> > as i described.. if you want a example run a new web gambas project, and
> in
> > a console see the process with ps and its basically that i described...
> >
> >
> >>
> >>
> >>
> >>>
> >>>>
> >>>> To make it more concrete. Imagine there is a help file in html. When
> the
> >>>> user clicks on the proper button, I'll read it
> >>>> and display it so the user can see the document. I want a method to
> >>>> display it rendered as it would be rendered in a browser.
> >>>>
> >>>> The editor might be able to do it. But then, I can't find instructions
> >>>> on how to create it, load and display de text.
> >>>>
> >>>> I have also found two lines of code that hint on the way to do it,
> but I
> >>>> can not learn enough from them. Says the guy:
> >>>>
> >>>> Then in Gambas2 I have a form with Textedit1 and I add:
> >>>> textedit1.text=file.load("filename.html") in my form_open sub
> >>>>
> >>>> I would guess textedit1.text is in a form that, when displayed, will
> >>>> render the file correctly.
> >>>> But then again, I can't find the rest of the code.
> >>>>
> >>>> Thank you.
> >>>>
> >>>> - fernando
> >>>>
> >>>>
> >>>> 2017-07-02 10:07 GMT-03:00 PICCORO McKAY Lenz <mckaygerhard at ...626...
> >:
> >>>>
> >>>>> hi fernando,, u must read as stream.. see it:
> >>>>>
> >>>>> here a example minimal: http://gambaswiki.org/wiki/lang/lineinput
> >>>>>
> >>>>> but i think that what do you want its "understand" the file format!
> >>>>> right?
> >>>>>
> >>>>> due i guess rtf files have some "rich"text inside.. something in some
> >>>>> binary/specific non ascii/plain text ...
> >>>>>
> >>>>> Lenz McKAY Gerardo (PICCORO)
> >>>>> http://qgqlochekone.blogspot.com
> >>>>>
> >>>>> 2017-07-02 7:31 GMT-04:30 Fernando Cabral <
> fernandojosecabral at ...626...
> >>>>> >:
> >>>>>
> >>>>>> I've browsed the documentation but did not find what I am looking
> for:
> >>>>>> a
> >>>>>> way do read a html (or rtf) file and display it using some built in
> >>>>>> method.
> >>>>>> Say, something simple like this:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> *Public Sub Main() Dim TextFile As File Dim RtfText As String
> >>>>>> TextFile =
> >>>>>> Open "~/Doc.rtf" For Read Line Input #TextFile, RtfText
> >>>>>> FMain.LoadText(RtfFile) *' Here is the rub!
> >>>>>>
> >>>>>> * FMain.ShowmodalEnd*
> >>>>>>
> >>>>>> Regards
> >>>>>>
> >>>>>> - fernando
> >>>>>> --
> >>>>>> Fernando Cabral
> >>>>>> Blogue: http://fernandocabral.org
> >>>>>> Twitter: http://twitter.com/fjcabral
> >>>>>> e-mail <http://twitter.com/fjcabrale-mail>:
> >>>>>> fernandojosecabral at ...626...
> >>>>>> Facebook: f at ...3654...
> >>>>>> Telegram: +55 (37) 99988-8868 <%2837%29%2099988-8868>
> >>>>>> Wickr ID: fernandocabral
> >>>>>> WhatsApp: +55 (37) 99988-8868 <%2837%29%2099988-8868>
> >>>>>> Skype: fernandojosecabral
> >>>>>> Telefone fixo: +55 (37) 3521-2183 <%2837%29%203521-2183>
> >>>>>> Telefone celular: +55 (37) 99988-8868 <%2837%29%2099988-8868>
> >>>>>>
> >>>>>> Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
> >>>>>> nenhum político ou cientista poderá se gabar de nada.
> >>>>>> ------------------------------------------------------------
> >>>>>> ------------------
> >>>>>> Check out the vibrant tech community on one of the world's most
> >>>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> >>>>>> _______________________________________________
> >>>>>> Gambas-user mailing list
> >>>>>> Gambas-user at lists.sourceforge.net
> >>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>> --
> >>>> Fernando Cabral
> >>>> Blogue: http://fernandocabral.org
> >>>> Twitter: http://twitter.com/fjcabral
> >>>> e-mail: fernandojosecabral at ...626...
> >>>> Facebook: f at ...3654...
> >>>> Telegram: +55 (37) 99988-8868 <%2837%29%2099988-8868>
> >>>> Wickr ID: fernandocabral
> >>>> WhatsApp: +55 (37) 99988-8868 <%2837%29%2099988-8868>
> >>>> Skype: fernandojosecabral
> >>>> Telefone fixo: +55 (37) 3521-2183 <%2837%29%203521-2183>
> >>>> Telefone celular: +55 (37) 99988-8868 <%2837%29%2099988-8868>
> >>>>
> >>>> Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
> >>>> nenhum político ou cientista poderá se gabar de nada.
> >>>>
> >>>>
> >>>
> >>
> >>
> >> --
> >> Fernando Cabral
> >> Blogue: http://fernandocabral.org
> >> Twitter: http://twitter.com/fjcabral
> >> e-mail: fernandojosecabral at ...626...
> >> Facebook: f at ...3654...
> >> Telegram: +55 (37) 99988-8868
> >> Wickr ID: fernandocabral
> >> WhatsApp: +55 (37) 99988-8868
> >> Skype: fernandojosecabral
> >> Telefone fixo: +55 (37) 3521-2183
> >> Telefone celular: +55 (37) 99988-8868
> >>
> >> Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
> >> nenhum político ou cientista poderá se gabar de nada.
> >>
> >>
> > ------------------------------------------------------------
> ------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> --
> Fabien Bodard
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
--
Fernando Cabral
Blogue: http://fernandocabral.org
Twitter: http://twitter.com/fjcabral
e-mail: fernandojosecabral at ...626...
Facebook: f at ...3654...
Telegram: +55 (37) 99988-8868
Wickr ID: fernandocabral
WhatsApp: +55 (37) 99988-8868
Skype: fernandojosecabral
Telefone fixo: +55 (37) 3521-2183
Telefone celular: +55 (37) 99988-8868
Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
nenhum político ou cientista poderá se gabar de nada.
More information about the User
mailing list