Bug 118614

Summary: When a form showing a date field containing a valid date is exported as a PDF file with "Create PDF form" checked, the resultant PDF file shows an empty field.
Product: LibreOffice Reporter: Alan Wheeler <ostersund18647>
Component: Printing and PDF exportAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: trivial CC: drewjensen.inbox, jwaugh, xiscofauli
Priority: low Keywords: filter:pdf, needsDevAdvice
Version: Inherited From OOo   
Hardware: All   
OS: All   
URL: https://crazymedium.com
Whiteboard: PDF Books
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 103378    
Attachments: To demonstrate empty date field

Description Alan Wheeler 2018-07-07 20:58:46 UTC
Created attachment 143382 [details]
To demonstrate empty date field

When a form showing a date field containing a valid date is exported as a PDF file with "Create PDF form" checked, the resultant PDF file shows an empty field.

To demonstrate :-
1.	Open the attached "Test5 - Date.odb" database file.
2.	Open form "Form1" - this will display a form containing a single field of type date containing "31/12/81".
3.	From the menu bar, select "File", then "Export as PDF..."
4.	On the right hand side of the resultant "PDF Options" panel, check only "Create PDF Form" and "View PDF after export", then select "Export"
5.	Save the resultant PDF file to a convenient place - it will then be automatically displayed.
6.	Observe that the PDF file contains a single empty editable field - it has not been preset to contain "31/12/81"
Comment 1 Alan Wheeler 2018-07-07 21:40:29 UTC
Bug 107402 (now shown as WORKSFORME) described similar symptoms as part of a more general complaint about exporting as PDF. The current bug report is more specific, so should be easier to reproduce (and hopefully fix). Should bug 107402 be marked as a duplicate of this one (118614)?
Comment 2 Drew Jensen 2018-07-07 22:30:49 UTC
(In reply to Alan Wheeler from comment #0)
> Created attachment 143382 [details]
> To demonstrate empty date field
> 
> When a form showing a date field containing a valid date is exported as a
> PDF file with "Create PDF form" checked, the resultant PDF file shows an
> empty field.
> 

Yes, I can confirm that there is no way to get that default string into the form control in the PDF file. 

Doing a search just nor though I find that even with Adobe tools the solution to default dates as strings (and other strings defaults) is by using a snippet of javascript embedded in the PDF file. The adobe tools offer a scripting environment similar to that in LibreOffice for basic (etc.).

So, I'm not sure this is an error in LibreOffice. 
It would be great if there were an OS tool that would let you apply the solution from recommended in the Adobe forums.
Comment 3 Alan Wheeler 2018-07-30 00:59:52 UTC
I have discovered a workaround.

If, after the form is displayed, but before exporting as PDF, the date field is modified (I added a space after "31/12/81", then removed the space), the field in the resultant PDF file HAS been preset to "31/12/81".

If the form contains several date fields, it is necessary to modify each one in order for all the relevant fields on the resultant PDF file to have been preset.
Comment 4 Alan Wheeler 2018-09-05 14:20:38 UTC
Tested with LibreOffice 3.3.0.
Exactly the same symptoms as described in the original bug report are exhibited using 3.3.0, so set version to "Inherited from OOo"
Comment 5 mgx0996 2020-04-28 05:48:26 UTC Comment hidden (spam)
Comment 6 sbhilyrics 2021-05-17 17:12:35 UTC Comment hidden (spam)
Comment 7 mgx0996 2021-05-19 17:06:42 UTC
Thanks for sharing this
Comment 8 Xisco FaulĂ­ 2022-05-19 12:01:04 UTC
The issue is only reproducible if you don't change the value in the form, If you change it to another date and then you save to PDF, the date is there in the PDF
Comment 9 Alan Wheeler 2023-01-12 23:47:59 UTC
Still present in LibreOffice 7.4.4