Email "Button" to send a .pdf formular via mail

Discuss the word processor

Email "Button" to send a .pdf formular via mail

Postby davin » Wed Dec 06, 2017 12:46 pm

Hello everybody,

hopefully you can help me with my issue. Got a little problem and i'm kinda stuck atm.
First of all I want to say I'm a beginner in OpenOffice.

I made a formular for our costumers so we can evaluate the costumer satisfaction rate. I've made pretty good progress with the formular so far but now I want to add a e-mail button where the costumer can send his fully filled formular back to our office e-mail adress. The problem is I have no idea how to solve that.

Any ideas? :roll:

Grateful in advance

davin
Last edited by robleyd on Wed Dec 06, 2017 12:53 pm, edited 1 time in total.
Reason: Remove Known Issue icon - robleyd
OpenOffice 4.1.4
davin
 
Posts: 2
Joined: Wed Dec 06, 2017 12:28 pm

Re: Email "Button" to send a .pdf formular via mail

Postby John_Ha » Wed Dec 06, 2017 2:08 pm

Welcome to the forum.

If you include " mailto:fred@example.com " in your form then, when someone clicks on " mailto:fred@example.com " in the PDF, it opens an email addressed to fred@example.com. See attached PDF. This does not create a subject line nor does it attach the PDF. Also, I think the user has to allow mailto: to open an email - I think it is default behaviour, but it can be prevented.

See mailto in wiki for more ideas.

As a new poster you will find much useful information in the Writer FAQ, the Writer Tutorials, the up to date Writer guide and the Writer Manual (especially Chapter 15 - Using Forms in Writer). When a pop-up window opens, click the Help button for extensive help on that function - it is often more comprehensive than the manual.

Also try searching the forum with email pdf form. Try Googling with email pdf form.

If your problem is solved please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
Attachments
test.pdf
(27.24 KiB) Downloaded 317 times
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6772
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Email "Button" to send a .pdf formular via mail

Postby davin » Thu Dec 07, 2017 9:22 am

Thank you for your quick reply John!

Okay I see. Tested it and I can do this.
But - isn't there any option that the (saved) pdf file is attached to the email ? Our costumers are mainly older people who aren't used to attaching a file in an email. We fear that we won't get any respond.
I mean I know I could do this but this doesn't really solve my problem: mailto:fred@example.com?subject=my report&body=see attachment&attachment="/my_location_virtual_path/myfile.lis"

I googled a lot but didn't find the right answer tbh - same for the forum.

Thank you very much!
OpenOffice 4.1.4
davin
 
Posts: 2
Joined: Wed Dec 06, 2017 12:28 pm

Re: Email "Button" to send a .pdf formular via mail

Postby musikai » Thu Dec 07, 2017 12:29 pm

I think this solution with pdf is difficult. To fill out the pdf a pdf-reader like adobe or pdfxchange or foxit must already be installed on the system. If you have a fresh installed windows 10 then the pdf will be opened in the browser app that isn't capable of filling out pdfs. Even when the person managed to fill out the pdf how are you going to know where he saved it? So either give detailed instructions or let the people give answeres directly in the email or create a website with form.

Edit: ok, there seems to be a way for PDFs to send themselve back to an email address:
Acrobat JavaScript mailDoc() method
But you can't create Javascript Buttons with OpenOffice AFAIK.
Scribus might work:
http://forums.scribus.net/index.php?topic=1368.0

Edit:
With scribus you can create your form and a button with this Javascript:
Code: Select all   Expand viewCollapse view
this.mailDoc({
bUI: false,
cTo: "your email address",
cCC: "cc email address",
cSubject: "Order Form - Books",
cMsg: "Thanks for placing this order. We appreciate your business."
});

This will work.
Attachments
Scribus_maildoc.pdf
(67.14 KiB) Downloaded 306 times
Last edited by musikai on Thu Dec 07, 2017 2:10 pm, edited 3 times in total.
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/libreofficesongbookarchitect.html
musikai
Volunteer
 
Posts: 243
Joined: Wed Nov 11, 2015 12:19 am

Re: Email "Button" to send a .pdf formular via mail

Postby John_Ha » Thu Dec 07, 2017 12:32 pm

Once you can get the command to work you can convert it to a link by highlighting it and going Insert > Hyperlink ...

The problem is I cannot get the command to work :crazy:

I think Googling will be your best bet - if you can find how to do it in MS Word the same should work in Writer.
Attachments
with link.odt
(9.58 KiB) Downloaded 105 times
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6772
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Email "Button" to send a .pdf formular via mail

Postby musikai » Fri Dec 08, 2017 1:23 pm

Hi John,
You were quite close.
What works is giving Subject and body. Attachments are not supported by "mailto"-protocoll.
So for automatically attaching files to an answer one would have to use Scribus as posted before.
Good thing is you can import your OO_PDf with forms into Scribus and just add the javascript-button there (as described in earlier post).
Attachments
open_OO_PDF_in_Scribus_and_add_Button1.pdf
imported PDF from OO into Scribus and added Button with Javascript (attachment possible)
(83.38 KiB) Downloaded 199 times
with link2.odt
OO with email subject and body (attachment not possible)
(11.35 KiB) Downloaded 108 times
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/libreofficesongbookarchitect.html
musikai
Volunteer
 
Posts: 243
Joined: Wed Nov 11, 2015 12:19 am

Re: Email "Button" to send a .pdf formular via mail

Postby John_Ha » Fri Dec 08, 2017 1:30 pm

Excellent. Your PDF works for me - it opens an addressed email with the PDF attached.

Good thing is you can import your OO_PDf with forms into Scribus and just add the javascript-button there (as described in earlier post).

Inspect the PDF files with and without the button - you might find you can just edit the PDF file created by AOO with Notepad or Notepad++ (better) and insert the required content, copied from the Scribus PDF, to do what you want.

If your problem is solved please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject. Also it should be form, not formula, in the subject.
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6772
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Email "Button" to send a .pdf formular via mail

Postby musikai » Fri Dec 08, 2017 2:06 pm

John_Ha wrote:Inspect the PDF files with and without the button - you might find you can just edit the PDF file created by AOO with Notepad or Notepad++ (better) and insert the required content, copied from the Scribus PDF, to do what you want.

Have you tried that? I always find it difficult to read PDF-code.
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/libreofficesongbookarchitect.html
musikai
Volunteer
 
Posts: 243
Joined: Wed Nov 11, 2015 12:19 am

Re: Email "Button" to send a .pdf formular via mail

Postby John_Ha » Fri Dec 08, 2017 2:42 pm

musikai wrote:Have you tried that? I always find it difficult to read PDF-code.

A PDF is a mix of flat ASCII and binary.

If you could upload a minimal PDF (just one or two words) saved in Scribus without the button; and then add the button, and save it in Scribus, the "added button" code should be the only difference in the two PDFs and, even if it is binary, it may be able to be isolated.

I searched the PDF you uploaded but could not find the email ID so I think the "button" must be coded in binary.

See Understanding the Portable Document Format (PDF)
Attachments
Clipboard01.png
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6772
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Email "Button" to send a .pdf formular via mail

Postby musikai » Fri Dec 08, 2017 8:37 pm

Hi John,
Thank you for the "Understanding PDF" link!!!
To get a readable PDF I uncompressed the Scribus PDFs with PDFtk and could examine the bit about the added Java script.

Now I tried this:
Out of OO I exported a PDF only with a button(no action) (left side of the pic). Then with Notepad++ changed the action to run the added Javascript object. (right side of the pic). The result is a PDF with a workin button but somewhat incorrect xref-datastreams (as PDFXchange Editor tells me. Saving again in PDFXchange Reader would correct this).
Surely one would have to be more precise about how adding stuff to PDF works to get all correct.
So this was only a dirty hack and shouldn't be used at least this way :-) Better one uses Scribus.
Add_Javascript_to_Button_Hack.PNG
Hacked PDF
Attachments
button_with javascript_action.pdf
(9 KiB) Downloaded 102 times
emptybutton.pdf
PDF from OO only with button with no assigned action
(8.75 KiB) Downloaded 68 times
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/libreofficesongbookarchitect.html
musikai
Volunteer
 
Posts: 243
Joined: Wed Nov 11, 2015 12:19 am

Re: Email "Button" to send a .pdf formular via mail

Postby John_Ha » Fri Dec 08, 2017 9:12 pm

musikai wrote:So this was only a dirty hack and shouldn't be used at least this way :-) Better one uses Scribus.

I agree. But was worth having a look ...

I tried copying 7 + 23, and renaming 23 to 21, and replacing 7 + 21, but I got an error opening the PDF. I also changed the 23 in Object 7 to 21 but still got the error.

I doubt we are very wrong - I expect there is just a little mismatch somewhere...
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6772
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Email "Button" to send a .pdf formular via mail

Postby John_Ha » Fri Dec 08, 2017 9:29 pm

Got it!

1. Copy 7 0 obj ... endobj and 23 0 obj ... endobj from the PDF with the javascript

copy this.png

2. Delete 7 0 obj ... endobj in the PDF without the javascript, and replace it with what was copied

replace this.png

It now works ...

... but is a nasty hack. It looks like 7 0 obj item has the location co-ordinates for the box so they need to be correct for the new document. But you could always edit them to put the box where you want ... 8-)
Attachments
emptybutton-edited.pdf
empty_button.PDF edited as above
(9 KiB) Downloaded 72 times
AOO 4.1.6, Windows 7 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
 
Posts: 6772
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Email "Button" to send a .pdf formular via mail

Postby musikai » Fri Dec 08, 2017 11:22 pm

Hi John,
works but PDFXchange still complaints about xref structure.
I think hacking the PDF really is the hard way. Also I found out that the javascript-Button doesn't work in Foxit-Reader (Scribus and Openoffice PDFs).
But here is a solution that works in PDFXchange and Foxit Reader. AND is native OpenOffice way.
It doesn't send back the whole PDF but the form_data (.fdf) that can easily be read with a text editor.
https://www.libreoffice-forum.de/viewto ... 6379#p8223

You can create a button in OO, double click on it and set its action property to "submit form".
Button_Property_Action.PNG

To assign your email address right click on the button and choose "Form"
Form-properties.PNG
Form-properties.PNG (18.37 KiB) Viewed 5904 times


Now when the button is clicked in the PDF, the email program will be started with the email-address and the form-data.fdf attached.
The subject and body text can't be set. They will be filled by the PDF-Reader. It mostly reads:
subject: Data from "pdfname.pdf"
body: The attached file contains data which was filled into a form...

I simply reattach the files from the other forum here.
Attachments
Mail-Formular.odt
(11.24 KiB) Downloaded 107 times
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/libreofficesongbookarchitect.html
musikai
Volunteer
 
Posts: 243
Joined: Wed Nov 11, 2015 12:19 am

Re: Email "Button" to send a .pdf formular via mail

Postby musikai » Sat Dec 09, 2017 12:43 pm

Hahaha,
this was really a circle walk!
You can get the forms sent back as PDF as well. Just set it in the PDF-Export-Options:
FDF_PDF_HTML_XML.PNG


4 formats are possible:
1.FDF
(is said to be recommended for greatest compatibility)
2.PDF
(is said to make sometimes trouble on Acrobat Readers. Don't know. )
3.HTML
4.XML
XML will create a .xfdf which is nicer formatted than FDF. Can also be dragged into PDF-Readers.
It also looks like the best format when somebody wants to import the datas into a database. But I haven't found any project for OpenOffice that does that.
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/libreofficesongbookarchitect.html
musikai
Volunteer
 
Posts: 243
Joined: Wed Nov 11, 2015 12:19 am

Re: Email "Button" to send a .pdf formular via mail

Postby musikai » Sat Dec 09, 2017 11:45 pm

For the .xfdf-files that one gets back by using the "XML" Option in the PDF Export-Options I wrote a Converter to CSV:
https://forum.openoffice.org/en/forum/v ... 85#p433685
Please test!
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/libreofficesongbookarchitect.html
musikai
Volunteer
 
Posts: 243
Joined: Wed Nov 11, 2015 12:19 am

Re: Email "Button" to send a .pdf formular via mail

Postby musikai » Sun Dec 10, 2017 5:09 pm

Hey Guys and Girls :-)
I modified the code above so you can collect all the .xfdf-answeres, put them in a folder and create 1 merged csv from them that gives you a nice table.
I searched the web for such an app and it seems you can save quite some bucks and spend for xmas instead ;-)
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/libreofficesongbookarchitect.html
musikai
Volunteer
 
Posts: 243
Joined: Wed Nov 11, 2015 12:19 am

Re: Email "Button" to send a .pdf formular via mail

Postby musikai » Sun Dec 17, 2017 2:05 pm

Updated the converter to work with multiselection lists.
If you get sent back PDFs then you can create a CSV-Summery with this macro (using PDFtk):
https://forum.openoffice.org/en/forum/v ... 21&t=91588
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/libreofficesongbookarchitect.html
musikai
Volunteer
 
Posts: 243
Joined: Wed Nov 11, 2015 12:19 am


Return to Writer

Who is online

Users browsing this forum: No registered users and 40 guests