1. Create PDF files in Euphoria

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.

new topic     » topic index » view message » categorize

2. Re: Create PDF files in Euphoria

Do any of these help: Wkhtml, AcropdfDemo, Libharu4eu, TextToPdfConverter?

new topic     » goto parent     » topic index » view message » categorize

3. Re: Create PDF files in Euphoria

Could you create the original in html format? EuGTK has a one-click .pdf converter (see /examples/webkit.ex)

new topic     » goto parent     » topic index » view message » categorize

4. Re: Create PDF files in Euphoria

petelomax said...

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

new topic     » goto parent     » topic index » view message » categorize

5. Re: Create PDF files in Euphoria

irv said...

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.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Create PDF files in Euphoria

rneu said...

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?

new topic     » goto parent     » topic index » view message » categorize

7. Re: Create PDF files in Euphoria

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?

new topic     » goto parent     » topic index » view message » categorize

8. Re: Create PDF files in Euphoria

rneu said...

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.

new topic     » goto parent     » topic index » view message » categorize

9. Re: Create PDF files in Euphoria

Can you post some code showing how to convert an html file on disk to a pdf file? That will be very useful.

new topic     » goto parent     » topic index » view message » categorize

10. Re: Create PDF files in Euphoria

rneu said...

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

new topic     » goto parent     » topic index » view message » categorize

11. Re: Create PDF files in Euphoria

rneu said...

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....

new topic     » goto parent     » topic index » view message » categorize

12. Re: Create PDF files in Euphoria

rneu said...

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu