• putting data into a PDF document

    From internet.shopping@internet.shopping@foobox.com to comp.databases.ms-access on Thu Jul 23 09:17:22 2020
    From Newsgroup: comp.databases.ms-sqlserv

    I have a fillable pdf document that I did not create.

    I been asked if I can place data into it from my database.

    Looks as if it should be simple. However I do need to know or be able to name the fields (cells) that will contain the data.

    Does anyone know how I can find out the fields names? Or at least give them names?

    Once I have these I would need to open the pdf - any advice here would be welcome as to which application and then assign values to the named fields.


    Pointers in the direction of how to do this would be welcomed.

    Jim

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From =?UTF-8?Q?Ulrich_M=c3=b6ller?=@knobbi38@arcor.de to comp.databases.ms-access on Fri Jul 24 11:10:10 2020
    From Newsgroup: comp.databases.ms-sqlserv

    Hi Jim,

    Am 23.07.2020 um 18:17 schrieb internet.shopping@foobox.com:
    I have a fillable pdf document that I did not create.

    I been asked if I can place data into it from my database.

    Looks as if it should be simple. However I do need to know or be able to name the fields (cells) that will contain the data.

    Does anyone know how I can find out the fields names? Or at least give them names?

    Once I have these I would need to open the pdf - any advice here would be welcome as to which application and then assign values to the named fields.

    you can use PDFtk Tools for this purpose.
    See: https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

    Ulrich
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Mal Reeve@mal.reeve@gmail.com to comp.databases.ms-access on Fri Jul 24 06:15:08 2020
    From Newsgroup: comp.databases.ms-sqlserv

    This post relates to Excel, but the VBA would work in Access as well. https://www.excelforum.com/excel-programming-vba-macros/1204659-writing-excel-data-into-pdf-form.html

    It reads a pdf form to get all the field names and current values, and can also write to them as well.

    I've adapted it to look loop through whatever fields it finds, rather than hard coding the field names.
    Posting my slightly adjusted code below as well.

    I am only beginning this journey of writing to a pdf...so can't offer much more help than this.
    I'm about to explore what happens when I try to write to a field that doesn't exist.....

    Good Luck,
    Mal.

    Sub ReadAdobeFields()
    'Note: Remember to add your Adobe Acrobat Library in the VB Environment. 'Tools, References, Select the Adobe Acrobat Library.

    row_number = 10 'Adjust for where to start on Sheet.

    Dim AcrobatApplication As Acrobat.CAcroApp
    Dim AcrobatDocument As Acrobat.CAcroAVDoc
    Dim fcount As Long
    Dim sWrkshtName As String
    Dim sFileName As String

    'On Error Resume Next
    Set AcrobatApplication = CreateObject("AcroExch.App")
    Set AcrobatDocument = CreateObject("AcroExch.AVDoc")

    sFileName = Range("D5").Value

    If AcrobatDocument.Open(sFileName, "") Then
    AcrobatApplication.Show
    Set AcroForm = CreateObject("AFormAut.App")
    Set Fields = AcroForm.Fields
    fcount = Fields.Count ' Number of Fields

    For Each Field In Fields
    ActiveSheet.Range("D" & row_number) = Field.Name
    ActiveSheet.Range("E" & row_number) = Field.Value
    row_number = row_number + 1
    Next Field
    Else
    MsgBox "FAIL", vbOKOnly
    End If

    'Close template file & Acrobat.
    AcrobatDocument.Close True
    'AcrobatApplication.Exit

    Set AcrobatApplication = Nothing
    Set AcrobatDocument = Nothing
    Set Field = Nothing
    Set Fields = Nothing
    Set ActoForm = Nothing

    End Sub


    Sub WriteAdobeFields()
    'Note: Remember to add your Adobe Acrobat Library in the VB Environment. 'Tools, References, Select the Adobe Acrobat Library.

    row_number = 10 'Adjust for where to start on Sheet.

    Dim AcrobatApplication As Acrobat.CAcroApp
    Dim AcrobatDocument As Acrobat.CAcroAVDoc
    Dim fcount As Long
    Dim sFieldName As String
    Dim sFolderPath As String
    Dim sFileName As String
    Dim sWrkshtName As String
    Dim sTemplateName As String
    Dim sDATAtoWrite As String

    Set AcrobatApplication = CreateObject("AcroExch.App")
    Set AcrobatDocument = CreateObject("AcroExch.AVDoc")

    sTemplateName = Range("D5").Value
    sWrkshtName = ActiveSheet.Name

    'ADJUST to pass name of Template from each Worksheet
    If AcrobatDocument.Open(sTemplateName, "") Then
    AcrobatApplication.Show
    AcrobatApplication.Maximize 1
    Set AcroForm = CreateObject("AFormAut.App")
    Set Fields = AcroForm.Fields
    fcount = Fields.Count ' Number of Fields

    For Each Field In Fields
    sFieldName = ActiveSheet.Range("D" & row_number).Value
    sDATAtoWrite = ActiveSheet.Range("F" & row_number).Value

    'check to see if this field is one to write, skip if not
    If IsEmpty(ActiveSheet.Range("G" & row_number).Value) = False Then
    Fields(sFieldName).Value = sDATAtoWrite
    ActiveSheet.Range("h" & row_number).Value = "Done!"
    Else
    ActiveSheet.Range("h" & row_number).Value = "skipped"
    End If
    row_number = row_number + 1
    Next Field

    'ORIGINAL CODE COMMENTED OUT HERE
    ' Fields("Adults").Value = sWrkshtName.Range("C2").Value
    ' Fields("Students").Value = sWrkshtName.Range("C30").Value
    ' Fields("Group Name").Value = sWrkshtName.Range("C17").Value
    ' Fields("Campers NameRow1").Value = sWrkshtName.Range("C5").Value
    ' Fields("Campers NameRow2").Value = sWrkshtName.Range("C6").Value
    ' Fields("Campers NameRow3").Value = sWrkshtName.Range("C7").Value
    ' Fields("lunch").Value = sWrkshtName.Range("C51").Value

    Else
    MsgBox "failure"

    End If

    'Save PDF File
    'Leave open for edit/printing
    '? Close original template file
    sFolderPath = "C:\Users\Administrator\Desktop\ExcelFilesForV360"
    sFileName = sFolderPath & "\" & Fields("GroupName").Value & "-" & Format(Date, "dd-mm-yy") & ".pdf"

    Set AcroApp = CreateObject("AcroExch.App")
    Set avdoc = AcroApp.GetActiveDoc
    If Not (avdoc Is Nothing) Then
    Set PdDoc = avdoc.GetPDDoc
    PdDoc.Save PDSaveFull, sFileName
    End If

    'Close template file here.
    'AcrobatDocument.Close 1
    'AcrobatApplication.Exit

    Set AcrobatApplication = Nothing
    Set AcrobatDocument = Nothing
    Set Field = Nothing
    Set Fields = Nothing
    Set ActoForm = Nothing

    End Sub



    On Friday, July 24, 2020 at 2:17:25 AM UTC+10, internet...@foobox.com wrote:
    I have a fillable pdf document that I did not create.

    I been asked if I can place data into it from my database.

    Looks as if it should be simple. However I do need to know or be able to name the fields (cells) that will contain the data.

    Does anyone know how I can find out the fields names? Or at least give them names?

    Once I have these I would need to open the pdf - any advice here would be welcome as to which application and then assign values to the named fields.


    Pointers in the direction of how to do this would be welcomed.

    Jim

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Mal Reeve@mal.reeve@gmail.com to comp.databases.ms-access on Fri Jul 24 06:21:55 2020
    From Newsgroup: comp.databases.ms-sqlserv

    Forgot to highlight/mention...
    'Note: Remember to add your Adobe Acrobat Library in the VB Environment. 'Tools, References, Select the Adobe Acrobat Library.


    On Friday, July 24, 2020 at 11:15:12 PM UTC+10, Mal Reeve wrote:
    This post relates to Excel, but the VBA would work in Access as well. https://www.excelforum.com/excel-programming-vba-macros/1204659-writing-excel-data-into-pdf-form.html

    It reads a pdf form to get all the field names and current values, and can also write to them as well.

    I've adapted it to look loop through whatever fields it finds, rather than hard coding the field names.
    Posting my slightly adjusted code below as well.

    I am only beginning this journey of writing to a pdf...so can't offer much more help than this.
    I'm about to explore what happens when I try to write to a field that doesn't exist.....

    Good Luck,
    Mal.

    Sub ReadAdobeFields()
    'Note: Remember to add your Adobe Acrobat Library in the VB Environment. 'Tools, References, Select the Adobe Acrobat Library.

    row_number = 10 'Adjust for where to start on Sheet.

    Dim AcrobatApplication As Acrobat.CAcroApp
    Dim AcrobatDocument As Acrobat.CAcroAVDoc
    Dim fcount As Long
    Dim sWrkshtName As String
    Dim sFileName As String

    'On Error Resume Next
    Set AcrobatApplication = CreateObject("AcroExch.App")
    Set AcrobatDocument = CreateObject("AcroExch.AVDoc")

    sFileName = Range("D5").Value

    If AcrobatDocument.Open(sFileName, "") Then
    AcrobatApplication.Show
    Set AcroForm = CreateObject("AFormAut.App")
    Set Fields = AcroForm.Fields
    fcount = Fields.Count ' Number of Fields

    For Each Field In Fields
    ActiveSheet.Range("D" & row_number) = Field.Name
    ActiveSheet.Range("E" & row_number) = Field.Value
    row_number = row_number + 1
    Next Field
    Else
    MsgBox "FAIL", vbOKOnly
    End If

    'Close template file & Acrobat.
    AcrobatDocument.Close True
    'AcrobatApplication.Exit

    Set AcrobatApplication = Nothing
    Set AcrobatDocument = Nothing
    Set Field = Nothing
    Set Fields = Nothing
    Set ActoForm = Nothing

    End Sub


    Sub WriteAdobeFields()
    'Note: Remember to add your Adobe Acrobat Library in the VB Environment. 'Tools, References, Select the Adobe Acrobat Library.

    row_number = 10 'Adjust for where to start on Sheet.

    Dim AcrobatApplication As Acrobat.CAcroApp
    Dim AcrobatDocument As Acrobat.CAcroAVDoc
    Dim fcount As Long
    Dim sFieldName As String
    Dim sFolderPath As String
    Dim sFileName As String
    Dim sWrkshtName As String
    Dim sTemplateName As String
    Dim sDATAtoWrite As String

    Set AcrobatApplication = CreateObject("AcroExch.App")
    Set AcrobatDocument = CreateObject("AcroExch.AVDoc")

    sTemplateName = Range("D5").Value
    sWrkshtName = ActiveSheet.Name

    'ADJUST to pass name of Template from each Worksheet
    If AcrobatDocument.Open(sTemplateName, "") Then
    AcrobatApplication.Show
    AcrobatApplication.Maximize 1
    Set AcroForm = CreateObject("AFormAut.App")
    Set Fields = AcroForm.Fields
    fcount = Fields.Count ' Number of Fields

    For Each Field In Fields
    sFieldName = ActiveSheet.Range("D" & row_number).Value
    sDATAtoWrite = ActiveSheet.Range("F" & row_number).Value

    'check to see if this field is one to write, skip if not
    If IsEmpty(ActiveSheet.Range("G" & row_number).Value) = False Then
    Fields(sFieldName).Value = sDATAtoWrite
    ActiveSheet.Range("h" & row_number).Value = "Done!"
    Else
    ActiveSheet.Range("h" & row_number).Value = "skipped"
    End If
    row_number = row_number + 1
    Next Field

    'ORIGINAL CODE COMMENTED OUT HERE
    ' Fields("Adults").Value = sWrkshtName.Range("C2").Value
    ' Fields("Students").Value = sWrkshtName.Range("C30").Value
    ' Fields("Group Name").Value = sWrkshtName.Range("C17").Value
    ' Fields("Campers NameRow1").Value = sWrkshtName.Range("C5").Value
    ' Fields("Campers NameRow2").Value = sWrkshtName.Range("C6").Value
    ' Fields("Campers NameRow3").Value = sWrkshtName.Range("C7").Value
    ' Fields("lunch").Value = sWrkshtName.Range("C51").Value

    Else
    MsgBox "failure"

    End If

    'Save PDF File
    'Leave open for edit/printing
    '? Close original template file
    sFolderPath = "C:\Users\Administrator\Desktop\ExcelFilesForV360"
    sFileName = sFolderPath & "\" & Fields("GroupName").Value & "-" & Format(Date, "dd-mm-yy") & ".pdf"

    Set AcroApp = CreateObject("AcroExch.App")
    Set avdoc = AcroApp.GetActiveDoc
    If Not (avdoc Is Nothing) Then
    Set PdDoc = avdoc.GetPDDoc
    PdDoc.Save PDSaveFull, sFileName
    End If

    'Close template file here.
    'AcrobatDocument.Close 1
    'AcrobatApplication.Exit

    Set AcrobatApplication = Nothing
    Set AcrobatDocument = Nothing
    Set Field = Nothing
    Set Fields = Nothing
    Set ActoForm = Nothing

    End Sub



    On Friday, July 24, 2020 at 2:17:25 AM UTC+10, internet...@foobox.com wrote:
    I have a fillable pdf document that I did not create.

    I been asked if I can place data into it from my database.

    Looks as if it should be simple. However I do need to know or be able to name the fields (cells) that will contain the data.

    Does anyone know how I can find out the fields names? Or at least give them names?

    Once I have these I would need to open the pdf - any advice here would be welcome as to which application and then assign values to the named fields.


    Pointers in the direction of how to do this would be welcomed.

    Jim

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From =?UTF-8?Q?Ulrich_M=c3=b6ller?=@knobbi38@arcor.de to comp.databases.ms-access on Fri Jul 24 16:24:21 2020
    From Newsgroup: comp.databases.ms-sqlserv

    Hi Mal,

    Am 24.07.2020 um 15:21 schrieb Mal Reeve:
    Forgot to highlight/mention...
    'Note: Remember to add your Adobe Acrobat Library in the VB Environment. 'Tools, References, Select the Adobe Acrobat Library.
    and you also forgot to mention that an Adobe Acrobat must be installed
    and license is required.

    Ulrich
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From internet.shopping@internet.shopping@foobox.com to comp.databases.ms-access on Fri Jul 24 09:25:22 2020
    From Newsgroup: comp.databases.ms-sqlserv

    Thank you Mal and Ulrich for your comments.
    They are helpful and informative.
    It would appear that pdftk is a command line system. I was hoping for an API that could be used in the code. I have yet to download it to try it.
    I like the Adobe approach and is the way I had in mind. However I am aware that a license would be needed.
    I have seen another way of doing it by using SendKeys. Not a method I would normally adopt but is worth a try.
    Jim
    On Friday, 24 July 2020 15:24:26 UTC+1, Ulrich M||ller wrote:
    Hi Mal,

    Am 24.07.2020 um 15:21 schrieb Mal Reeve:
    Forgot to highlight/mention...
    'Note: Remember to add your Adobe Acrobat Library in the VB Environment. 'Tools, References, Select the Adobe Acrobat Library.
    and you also forgot to mention that an Adobe Acrobat must be installed
    and license is required.

    Ulrich
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Ron Paii@ron81pai@gmail.com to comp.databases.ms-access on Fri Jul 24 14:25:00 2020
    From Newsgroup: comp.databases.ms-sqlserv

    On Friday, July 24, 2020 at 8:15:12 AM UTC-5, mal....@gmail.com wrote:
    This post relates to Excel, but the VBA would work in Access as well. https://www.excelforum.com/excel-programming-vba-macros/1204659-writing-excel-data-into-pdf-form.html

    It reads a pdf form to get all the field names and current values, and can also write to them as well.

    I've adapted it to look loop through whatever fields it finds, rather than hard coding the field names.
    Posting my slightly adjusted code below as well.

    I am only beginning this journey of writing to a pdf...so can't offer much more help than this.
    I'm about to explore what happens when I try to write to a field that doesn't exist.....

    Good Luck,
    Mal.

    Sub ReadAdobeFields()
    'Note: Remember to add your Adobe Acrobat Library in the VB Environment. 'Tools, References, Select the Adobe Acrobat Library.

    row_number = 10 'Adjust for where to start on Sheet.

    Dim AcrobatApplication As Acrobat.CAcroApp
    Dim AcrobatDocument As Acrobat.CAcroAVDoc
    Dim fcount As Long
    Dim sWrkshtName As String
    Dim sFileName As String

    'On Error Resume Next
    Set AcrobatApplication = CreateObject("AcroExch.App")
    Set AcrobatDocument = CreateObject("AcroExch.AVDoc")

    sFileName = Range("D5").Value

    If AcrobatDocument.Open(sFileName, "") Then
    AcrobatApplication.Show
    Set AcroForm = CreateObject("AFormAut.App")
    Set Fields = AcroForm.Fields
    fcount = Fields.Count ' Number of Fields

    For Each Field In Fields
    ActiveSheet.Range("D" & row_number) = Field.Name
    ActiveSheet.Range("E" & row_number) = Field.Value
    row_number = row_number + 1
    Next Field
    Else
    MsgBox "FAIL", vbOKOnly
    End If

    'Close template file & Acrobat.
    AcrobatDocument.Close True
    'AcrobatApplication.Exit

    Set AcrobatApplication = Nothing
    Set AcrobatDocument = Nothing
    Set Field = Nothing
    Set Fields = Nothing
    Set ActoForm = Nothing

    End Sub


    Sub WriteAdobeFields()
    'Note: Remember to add your Adobe Acrobat Library in the VB Environment. 'Tools, References, Select the Adobe Acrobat Library.

    row_number = 10 'Adjust for where to start on Sheet.

    Dim AcrobatApplication As Acrobat.CAcroApp
    Dim AcrobatDocument As Acrobat.CAcroAVDoc
    Dim fcount As Long
    Dim sFieldName As String
    Dim sFolderPath As String
    Dim sFileName As String
    Dim sWrkshtName As String
    Dim sTemplateName As String
    Dim sDATAtoWrite As String

    Set AcrobatApplication = CreateObject("AcroExch.App")
    Set AcrobatDocument = CreateObject("AcroExch.AVDoc")

    sTemplateName = Range("D5").Value
    sWrkshtName = ActiveSheet.Name

    'ADJUST to pass name of Template from each Worksheet
    If AcrobatDocument.Open(sTemplateName, "") Then
    AcrobatApplication.Show
    AcrobatApplication.Maximize 1
    Set AcroForm = CreateObject("AFormAut.App")
    Set Fields = AcroForm.Fields
    fcount = Fields.Count ' Number of Fields

    For Each Field In Fields
    sFieldName = ActiveSheet.Range("D" & row_number).Value
    sDATAtoWrite = ActiveSheet.Range("F" & row_number).Value

    'check to see if this field is one to write, skip if not
    If IsEmpty(ActiveSheet.Range("G" & row_number).Value) = False Then Fields(sFieldName).Value = sDATAtoWrite
    ActiveSheet.Range("h" & row_number).Value = "Done!"
    Else
    ActiveSheet.Range("h" & row_number).Value = "skipped"
    End If
    row_number = row_number + 1
    Next Field

    'ORIGINAL CODE COMMENTED OUT HERE
    ' Fields("Adults").Value = sWrkshtName.Range("C2").Value
    ' Fields("Students").Value = sWrkshtName.Range("C30").Value
    ' Fields("Group Name").Value = sWrkshtName.Range("C17").Value
    ' Fields("Campers NameRow1").Value = sWrkshtName.Range("C5").Value
    ' Fields("Campers NameRow2").Value = sWrkshtName.Range("C6").Value
    ' Fields("Campers NameRow3").Value = sWrkshtName.Range("C7").Value
    ' Fields("lunch").Value = sWrkshtName.Range("C51").Value

    Else
    MsgBox "failure"

    End If

    'Save PDF File
    'Leave open for edit/printing
    '? Close original template file
    sFolderPath = "C:\Users\Administrator\Desktop\ExcelFilesForV360"
    sFileName = sFolderPath & "\" & Fields("GroupName").Value & "-" & Format(Date, "dd-mm-yy") & ".pdf"

    Set AcroApp = CreateObject("AcroExch.App")
    Set avdoc = AcroApp.GetActiveDoc
    If Not (avdoc Is Nothing) Then
    Set PdDoc = avdoc.GetPDDoc
    PdDoc.Save PDSaveFull, sFileName
    End If

    'Close template file here.
    'AcrobatDocument.Close 1
    'AcrobatApplication.Exit

    Set AcrobatApplication = Nothing
    Set AcrobatDocument = Nothing
    Set Field = Nothing
    Set Fields = Nothing
    Set ActoForm = Nothing

    End Sub
    On Friday, July 24, 2020 at 2:17:25 AM UTC+10, internet...@foobox.com wrote:
    I have a fillable pdf document that I did not create.

    I been asked if I can place data into it from my database.

    Looks as if it should be simple. However I do need to know or be able to name the fields (cells) that will contain the data.

    Does anyone know how I can find out the fields names? Or at least give them names?

    Once I have these I would need to open the pdf - any advice here would be welcome as to which application and then assign values to the named fields.


    Pointers in the direction of how to do this would be welcomed.

    Jim

    Use late binding and don't reference the Adobe library in the VBA environment.

    Trap error 429 "ActiveX component can't create object" when creating the application object.
    Set AcrobatApplication = CreateObject("AcroExch.App")

    You will only need Adobe Acrobat on computers importing PDF document data.

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Mal Reeve@mal.reeve@gmail.com to comp.databases.ms-access on Tue Jul 28 22:56:58 2020
    From Newsgroup: comp.databases.ms-sqlserv

    I have just discovered this approach which I believe would work well.
    It does depend on knowing the field names.
    The sample file it includes has a routine that will get those field name - IF you have the full version of ACROBAT installed.
    While I found a few postings about getting those names with READER DC - none of them worked for me.
    Perhaps dig up an older version of the free Reader software - which would apparently let you export the form data and take a look. (untested)

    Anyway....this page: http://www.excelhero.com/blog/2010/04/excel-acrobat-pdf-form-filler.html

    Shows how to use create an "fdf" file (Form data only).
    It's just a specially formatted text file.
    Once created, you just open it....it grabs the default program (Acrobat or Reader DC) and drops the data into the fields.

    I've done some basic testing with my situation and it's all working well with hard coded field names and data. Now on to use it in a looping function.

    Good luck!
    Mal.



    On Friday, July 24, 2020 at 2:17:25 AM UTC+10, internet...@foobox.com wrote:
    I have a fillable pdf document that I did not create.

    I been asked if I can place data into it from my database.

    Looks as if it should be simple. However I do need to know or be able to name the fields (cells) that will contain the data.

    Does anyone know how I can find out the fields names? Or at least give them names?

    Once I have these I would need to open the pdf - any advice here would be welcome as to which application and then assign values to the named fields.


    Pointers in the direction of how to do this would be welcomed.

    Jim

    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From internet.shopping@internet.shopping@foobox.com to comp.databases.ms-access on Wed Jul 29 08:54:10 2020
    From Newsgroup: comp.databases.ms-sqlserv

    It is interesting to see that someone else is trying to do this and finding it difficult. My client and I only have Acrobat Reader and not the Pro DC version. The latter would cost -u182 pa and I am not sure whether that limits the use to a single machine. The client may need to take out a number of licences.
    I found an alternative approach although It would not be my preferred way of doing it:
    Dim detailsRec As DAO.Recordset
    Set detailsRec = CurrentDb.OpenRecordset("SELECT WAVDemo.*, Customers.AccountName, Customers.Contact, CompactAddressOnLines(Customers.Address1, Customers.Address2, Customers.Address3, Customers.Town, Customers.County) As theAddress, Customers.PostCode, Customers.TelephoneNumber FROM WAVDemo LEFT JOIN Customers ON WAVDemo.CustomerID = Customers.CustomerID")
    FollowHyperLink thePdfFile
    Pause 3
    SendKeys "{TAB}", True
    SendKeys Nz(detailsRec("WAVConverter"), ""), True
    Pause 1
    SendKeys "{TAB}", True
    SendKeys Nz(detailsRec("AccountName"), ""), True
    Pause 1
    SendKeys "{TAB}", True
    SendKeys Nz(detailsRec("Demonstrator"), ""), True
    Pause 1
    SendKeys "{TAB}", True
    SendKeys Nz(detailsRec("Contact"), ""), True
    Pause 1
    SendKeys "{TAB}", True
    Pause 1
    SendKeys "{TAB}", True
    SendKeys Nz(DLookup("emailAddress", "Users", "UserID = " & getCurrentUserID), ""), True
    Pause 1
    SendKeys "{TAB}", True
    SendKeys Nz(detailsRec("theAddress"), "")
    Pause 1
    SendKeys "{TAB}", True
    SendKeys "{TAB}", True
    SendKeys Nz(detailsRec("PostCode"), ""), True
    Pause 1
    SendKeys "{TAB}", True
    SendKeys "{TAB}", True
    Pause 1
    SendKeys Nz(detailsRec("TelephoneNumber"), ""), True
    Pause 1
    SendKeys "^s", True
    Pause is my function to pause for the specified number of seconds. Seems to be necessary to slow the system down!!
    What surprised me that before I installed Acrobat the pdf file opened in Microsoft Edge. Strangely when I had Acrobat and opened the file in that, the tab order of the fields was different!!! How could that be? I would have expected the order to specified within the pdf itself.
    Without the full version of Acrobat I do not know the names of the fillable fields.
    Our current use is limited to this and will suffice for now. I would prefer an API where I could access the objects directly
    Jim
    On Wednesday, 29 July 2020 06:57:02 UTC+1, Mal Reeve wrote:
    I have just discovered this approach which I believe would work well.
    It does depend on knowing the field names.
    The sample file it includes has a routine that will get those field name - IF you have the full version of ACROBAT installed.
    While I found a few postings about getting those names with READER DC - none of them worked for me.
    Perhaps dig up an older version of the free Reader software - which would apparently let you export the form data and take a look. (untested)

    Anyway....this page: http://www.excelhero.com/blog/2010/04/excel-acrobat-pdf-form-filler.html

    Shows how to use create an "fdf" file (Form data only).
    It's just a specially formatted text file.
    Once created, you just open it....it grabs the default program (Acrobat or Reader DC) and drops the data into the fields.

    I've done some basic testing with my situation and it's all working well with hard coded field names and data. Now on to use it in a looping function.

    Good luck!
    Mal.



    On Friday, July 24, 2020 at 2:17:25 AM UTC+10, internet...@foobox.com wrote:
    I have a fillable pdf document that I did not create.

    I been asked if I can place data into it from my database.

    Looks as if it should be simple. However I do need to know or be able to name the fields (cells) that will contain the data.

    Does anyone know how I can find out the fields names? Or at least give them names?

    Once I have these I would need to open the pdf - any advice here would be welcome as to which application and then assign values to the named fields.


    Pointers in the direction of how to do this would be welcomed.

    Jim
    --- Synchronet 3.21d-Linux NewsLink 1.2