1. Create PDF files in Euphoria
- Posted by rneu Sep 15, 2017
- 1714 views
Can we create pdf files in Euphoria?
I searched for it but could not find any method mentioned.
Possibly one will need to draw text and images on a virtual canvas which will need to be saved in post-script format and then converted to pdf (I am just guessing and do not have any expertise in this area).
Any information in this regard will be appreciated.
2. Re: Create PDF files in Euphoria
- Posted by petelomax Sep 15, 2017
- 1714 views
Do any of these help: Wkhtml, AcropdfDemo, Libharu4eu, TextToPdfConverter?
3. Re: Create PDF files in Euphoria
- Posted by irv Sep 15, 2017
- 1677 views
Could you create the original in html format? EuGTK has a one-click .pdf converter (see /examples/webkit.ex)
4. Re: Create PDF files in Euphoria
- Posted by rneu Sep 15, 2017
- 1693 views
Do any of these help: Wkhtml, AcropdfDemo, Libharu4eu, TextToPdfConverter?
Very impressive. PCAN seems a great site. I was not aware of it. I had tried google search but could not find anything there: https://www.google.co.in/search?client=firefox-b&dcr=0&q=euphoria+language+create+pdf
5. Re: Create PDF files in Euphoria
- Posted by rneu Sep 15, 2017
- 1674 views
Could you create the original in html format? EuGTK has a one-click .pdf converter (see /examples/webkit.ex)
That would need html output for which one will have to learn it. I would prefer to be able to just specify the location and text/image.
6. Re: Create PDF files in Euphoria
- Posted by irv Sep 15, 2017
- 1668 views
That would need html output for which one will have to learn it. I would prefer to be able to just specify the location and text/image.
What software are you using to draw the image and add the text?
7. Re: Create PDF files in Euphoria
- Posted by rneu Sep 15, 2017
- 1657 views
I will have a sequence of strings in my Euphoria program which I want to be written on a regular A4 page. Also, if possible, a small logo image to be shown on the top of that page. Is this possible?
8. Re: Create PDF files in Euphoria
- Posted by irv Sep 15, 2017
- 1686 views
I will have a sequence of strings in my Euphoria program which I want to be written on a regular A4 page. Also, if possible, a small logo image to be shown on the top of that page. Is this possible?
No doubt there are a lot of different ways to do this, but I would just have my Eu program generate the html page, and then use the webkit to view (as html) and then convert to pdf. Here's a sample of a multi-page pdf I just created for you: README.html
Edit: if the layout of your pages doesn't change much, you could write an html "template" to control the size, font, position, etc of the elements, and have your Eu program "plug in" the text and filename of the logo. Very quick and easy.
9. Re: Create PDF files in Euphoria
- Posted by rneu Sep 15, 2017
- 1656 views
Can you post some code showing how to convert an html file on disk to a pdf file? That will be very useful.
10. Re: Create PDF files in Euphoria
- Posted by petelomax Sep 15, 2017
- 1669 views
Very impressive. PCAN seems a great site. I was not aware of it. I had tried google search but could not find anything there: https://www.google.co.in/search?client=firefox-b&dcr=0&q=euphoria+language+create+pdf
Thanks. Those files are also all available via the The Archive link in the "Misc Menu" on the right hand side of this and every page on this forum. Both that and PCAN are a better place to start searches for Eu code than google.
Pete
11. Re: Create PDF files in Euphoria
- Posted by irv Sep 15, 2017
- 1625 views
Can you post some code showing how to convert an html file on disk to a pdf file? That will be very useful.
I would just use Firefox (File/Print/Print to file and choose Output Format PDF).
Usually it is a good idea to use the tools that are available. Using Eu to do the whole thing would be like planting a tree to grow a handle to make a hammer to build a house....
12. Re: Create PDF files in Euphoria
- Posted by Spock Sep 17, 2017
- 1614 views
I will have a sequence of strings in my Euphoria program which I want to be written on a regular A4 page. Also, if possible, a small logo image to be shown on the top of that page. Is this possible?
I use Libharu4eu (but wrapped some more for Orac). It seems to do everything you want. Images are imported directly from files so logos are possible. It has fonts, borders, alignments, regions, .. I like the output. Page numbering is managed by your program rather than the library itself. Here is the top-level function for creating an invoice (that might span multiple pages) :
global function create(seq s) -- s contain the line data -- init PDF library init() if not NewDoc() then return 0 end if -- must call NewDoc() so that page dimensions work.. -- local init define_regions() init_data(s) int PageNumber = 1 -- make report while anydata() do NewPage() header() name_address() info(PageNumber) invoice_lines() sum() -- this is activated only when there is no more data footer() PageNumber += 1 end while -- save to disk save() -- tidy up EndDoc() -- exit return 1 end function
If you want I can bundle the code as a demo that you can modify to suit your requirements.
Spock