Printing email results

User 2056177 Photo


Registered User
232 posts

We have 4 forms on our website, 2 of which have approximately 60 questions. The sumitted results come into us by email which we then have to print.

In the old version of WFB, the printed emails resulted in 3 pages.

In the new version, the same results are coming out at 5, 6, or sometimes 7 pages depending on some of the answers.

I have tried reducing the padding in the text areas but this makes the questions too close together and also looks untidy.

Is there any way to reduce the spaces between answers on the emails so that we can get back to 3 page results?

We run a Boxer Dog Rescue in the UK and rely on donations so we need to keep down the added costs of using more paper.

Pete
User 187934 Photo


Senior Advisor
19,931 posts

Are you having the full [form_results] sent back to you? Have you tried having the individual elements sent back and placing them inside html tags on your notification to format the results?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 38401 Photo


Senior Advisor
10,951 posts

One very easy way to fix this is to copy and paste your results email into a text editor like Notepad and then print it. This would most likely remove all the added code that is embedded in emails and you would most likely have raw text only for your results. This may or may not be a solution, but it works for most things that you need to condense for printing purposes.
User 2056177 Photo


Registered User
232 posts

Thanks for the replies.but neither option is workable for us.
There must be a way within the html code to alter the format of the line spacing in the emails.
Pete
User 187934 Photo


Senior Advisor
19,931 posts

Looks to me you could make a custom external css page and place a link to it at the head of the notification.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 464893 Photo


Ambassador
1,611 posts


Thanks for the replies.but neither option is workable for us.
There must be a way within the html code to alter the format of the line spacing in the emails.
Pete

To get what you want have a look at the php examples of reading a csv file and extracting the data into variables. once you have them I believe they can be converted to pdf and thus printed in the form required.

I have done the first part but never had a reason to try to produce a pdf. A quick Google tells me there are tons of examples. I will help where I can just ask, It will be the excuse to learn for me. I can be contacted at http://inkmon.org/contact.html This is all a hobby with me.

I found this bit of simple code The comments need separating from the code but it is a start. As I have found there is so much available and by joining a forum there is expert help available
<?php
create handle for new PDF document $pdf = pdf_new();
open a file pdf_open_file($pdf, "philosophy.pdf");
start a new page (A4) pdf_begin_page($pdf, 595, 842);
get and use a font object $arial = pdf_findfont($pdf, "Arial", "host", 1); pdf_setfont($pdf, $arial, 10);
print text pdf_show_xy($pdf, "There are more things in heaven and earth, Horatio,", 50, 750); pdf_show_xy($pdf, "than are dreamt of in your philosophy", 50, 730);
end page pdf_end_page($pdf);
close and save file pdf_close($pdf);
?>


I will probably investigate the method it seems interesting and a bit more knowledge for me
The Guy from OZ


User 464893 Photo


Ambassador
1,611 posts

The go is to use the free class FPDF . Ignore the code above and Google FPDF you will find as I did that there are many examples on how to use it. Once the script is created and called from a browser(I am using WAMP Server to test) you can create the pdf and print. If you do not have Wamp installed then just upload the php file to your host to test
The steps are open the csv or SQL and get the data in variables
Use one of the examples of the use of FPDF and insert your data and print or save the created pdf.
I estimate it to be a 16hr task to knock it into shape and understand the method. After that it should be a breeze considering what is available.

If your data is in a csv file I can give you code I created to extract the data into variables ready to format the pdf.
The Guy from OZ


User 464893 Photo


Ambassador
1,611 posts

If you load this in notepad and give it a php extension, then upload it and the fpdf.php file you will have to acquire. You can test it. The result is a pdf output in a browser that can be printed or downloaded(Saved). I have been playing with examples. You could use your C Panel File Manager to edit or I believe Direct FTP can if you have it.
This is simple obviously, it takes the two variables that could be populated from the CSV file and output in seperate lines. This would compress the data quite markedly. I used a 12 point font, could be smaller and the gap reduced. It can also be formatted. Who says retirement is boring :)

<?php
$var="This could be one bit of data from form";
$var2="This could be another";
require('fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',12);
$pdf->Cell(20,5,$var,0,1);
$pdf->Cell(20,5,$var2,0,1);
$pdf->Output();
?>


The Guy from OZ


User 187934 Photo


Senior Advisor
19,931 posts

Thanks Prism. I'll give it try.:)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2056177 Photo


Registered User
232 posts

Thanks Prism, you seem to have spent a lot of time on my behalf and its appreciated.

Unfortunately, I am HTML illiterate so what you have written is all "gobble-de-gook" to me.

I have however got over the problem by converting the emails to plain text to print them and then back to HTML to save them on the PC.

Pete.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.