Results 1 to 2 of 2
  1. #1
    Thompyt is offline Expert
    Windows 11 Office 365
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    845

    Dig Sig blxes anchor

    All,
    Since I have completed the other thread, I have found an additional issue. In this document the sig blocks are correctly placed:

    Example1.pdf

    If I add two more rows, the Y value stays the same and places the signature blocks too high as in this example:

    Example3.pdf

    Do you have any thoughts on how I could anchor the signature blocks to the line on the bottom above the printed signature? Or perhaps a means to count the records and Multiply the y coordinate by that amount?

    (X, Z*(# of points+Y)+H, X+W, Z*Y) or some other means?




    I tried the below with adding the X & Y into the point coordinates, but the signature box disappears. I figured each row equals 15 points. 1 row works fine so need to delete that row. (3 rows - 1)*15 equals 30 points. Since the block needs to go down, you have to subtract the 30 from the original starting point of Y and Y+H or 134 and (134+40) =174

    174-30 = 144 and 134 - 30 = 104. Verified by manually moving block to new position and looking at the point coordinates. With the correct coordinate points added in the sig blocks disappear.

    Code:
    Public Sub AddSigBoxes()Dim App As Object, AVdoc As Object, AForm As Object, Cnt As Integer, Y As Integer, X As Integer
    Dim TODA As String, FNames As String, Rev As String, FT As String, Path As String, js As String, js1 As String, js2 As String
    
    
        On Error GoTo Err_Handler
        Cnt = DCount("SLeg", "[QryTAR]")
        TODA = DLookup("[TODA]", "[QryTAR]")
        FNames = DLookup("[FNames]", "[QryTAR]")
        Rev = DLookup("[Type]", "[QryTAR]")
        FT = DLookup("[FTCode]", "[QryTAR]")
        
        Y = 134 - ((Cnt - 1) * 15)
        X = 174 - ((Cnt - 1) * 15)
        
        Set App = CreateObject("Acroexch.app")
            App.Hide
        Set AVdoc = CreateObject("AcroExch.AVDoc")
        Set AForm = CreateObject("AFormAut.App")
           
        Path = "C:\TEMP\" & "0009TAR(" & FNames & ")(" & TODA & ")(" & [FT] & ")" & Rev & "_" & TOD & ".pdf"
        
        If AVdoc.Open(Path, "") Then
            js = "f = this.addField(""SignatureField"", ""signature"", 0, [26,X,514,243,Y]);" & "f.value = ""TPOC""; " & " f.flatten"
                AForm.Fields.ExecuteThisJavaScript js
            js1 = "f = this.addField(""SignatureField1"", ""signature"", 0, [267,X,483,Y]);" & "f.value = ""PM""; " & "f.flatten"
                AForm.Fields.ExecuteThisJavaScript js1
            js2 = "f = this.addField(""SignatureField2"", ""signature"", 0, [534,174,750,134]);" & "f.value = ""COR""; " & "f.flatten"
                AForm.Fields.ExecuteThisJavaScript js2
        
           Path = Left(Path, Len(Path) - 4) & "s.pdf"
             
        Set AForm = AVdoc.GetPDDoc
            AForm.Save PDSaveFull, Path
                AVdoc.Close False
        End If
    
    
        App.Exit
    
    
        Set App = Nothing
        Set AVdoc = Nothing
        Set AForm = Nothing
        Path = ""
            
    Exit_Proc:
        Exit Sub
    
    
    Err_Handler:
        MsgBox "Error: " & Err.Number & " - " & Err.Description
        Resume Exit_Proc
    
    
    End Sub





    Thanks
    T

  2. #2
    Thompyt is offline Expert
    Windows 11 Office 365
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    845
    Below is the solved issue:

    Code:
    Public Sub AddSigBoxes()Dim App As Object, AVdoc As Object, AForm As Object, Cnt As Integer, Y As Integer, X As Integer
    Dim TODA As String, FNames As String, Rev As String, FT As String, Path As String, js As String, js1 As String, js2 As String, Cord As String, Cord1 As String, Cord2 As String
    
    
        On Error GoTo Err_Handler
        Cnt = DCount("SLeg", "[QryTAR]") - 1
        TODA = DLookup("[TODA]", "[QryTAR]")
        FNames = DLookup("[FNames]", "[QryTAR]")
        Rev = DLookup("[Type]", "[QryTAR]")
        FT = DLookup("[FTCode]", "[QryTAR]")
        
        X = 174 - Cnt * 15
        Y = 134 - Cnt * 15
        
        Cord = "[26," & X & ",217," & Y & "]"
        Cord1 = "[267," & X & ",483," & Y & "]"
        Cord2 = "[534," & X & ",750," & Y & "]"
        
        Set App = CreateObject("Acroexch.app")
            App.Hide
        Set AVdoc = CreateObject("AcroExch.AVDoc")
        Set AForm = CreateObject("AFormAut.App")
           
        Path = "C:\TEMP\" & "0009TAR(" & FNames & ")(" & TODA & ")(" & [FT] & ")" & Rev & "_" & TOD & ".pdf"
        
        If AVdoc.Open(Path, "") Then
            js = "f = this.addField(""SignatureField1"", ""signature"", 0, " & Cord & ");" & "f.value = ""TPOC""; " & " f.flatten" ' [26,174,217,134]
                AForm.Fields.ExecuteThisJavaScript js
            js1 = "f = this.addField(""SignatureField2"", ""signature"", 0, " & Cord1 & ");" & "f.value = ""PM""; " & "f.flatten" ' [267,174,483,134]
                AForm.Fields.ExecuteThisJavaScript js1
            js2 = "f = this.addField(""SignatureField3"", ""signature"", 0, " & Cord2 & ");" & "f.value = ""COR""; " & "f.flatten" ' [534,174,750,134]
                AForm.Fields.ExecuteThisJavaScript js2
    
    
           Path = Left(Path, Len(Path) - 4) & "s.pdf"
             
        Set AForm = AVdoc.GetPDDoc
        
            AForm.Save PDSaveFull, Path
                AVdoc.Close False
        End If
    
    
        App.Exit
    
    
        Set App = Nothing
        Set AVdoc = Nothing
        Set AForm = Nothing
        Path = ""
            
    Exit_Proc:
        Exit Sub
    
    
    Err_Handler:
        MsgBox "Error: " & Err.Number & " - " & Err.Description
        Resume Exit_Proc
    
    
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 05-31-2017, 11:50 AM
  2. Current Monday as an anchor in a query
    By lonesoac0 in forum Queries
    Replies: 5
    Last Post: 10-07-2016, 07:20 AM
  3. Anchor pages in tab control
    By snoopy2003 in forum Programming
    Replies: 2
    Last Post: 03-24-2012, 08:26 AM
  4. Anchor control to bottom of detail section
    By talley in forum Reports
    Replies: 0
    Last Post: 04-04-2011, 10:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums