Visual Basic para Aplicaciones - PDAnnot - PDF VBA

Life is soft - evento anual de software empresarial
 
Vista:

PDAnnot - PDF VBA

Publicado por Oscar Rubió (19 intervenciones) el 08/11/2016 12:00:12
Sabría alguien decirme el motivo por el que no admite la propiedad textSize del siguiente script?:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Set acroApp = CreateObject("acroexch.app")
    Set miPdf = CreateObject("acroexch.pddoc")
    acroApp.Show
    miPdf.Open (miAr)
    Set jso = miPdf.GetJSObject
    If Not jso Is Nothing Then
            Set miPag = miPdf.AcquirePage(0)
            Set pageRect = miPag.GetSize
            Point(0) = 10
            Point(1) = pageRect.y
            popupRect(0) = 20
            popupRect(1) = pageRect.y - 10
            popupRect(2) = 570
            popupRect(3) = pageRect.y - 55
            Set miAnot = jso.AddAnnot
            Set props = miAnot.getprops
            props.Page = i
            props.Name = "LLOPEZ PROCURADORES, SLP"
            props.Type = "FreeText"
            props.Rect=popupRect
            props.textSize=8
            props.Contents="prueba"
      End if
 
miAnot.setProps.props

Uso Adobe Acrobat X Pro, y miAr es la ruta del archivo que abro.

Gacias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

PDAnnot - PDF VBA

Publicado por Oscar Rubió (19 intervenciones) el 24/11/2016 11:27:32
Al final encontré la solución. Para ello, al script que ya teníamos, a saber:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Set acroApp = CreateObject("acroexch.app")
 
    Set miPdf = CreateObject("acroexch.pddoc")
 
    acroApp.Show
 
    miPdf.Open (miAr)
 
    Set jso = miPdf.GetJSObject
 
    If Not jso Is Nothing Then
 
            Set miPag = miPdf.AcquirePage(0)
 
            Set pageRect = miPag.GetSize
 
            Point(0) = 10
 
            Point(1) = pageRect.y
 
            popupRect(0) = 20
 
            popupRect(1) = pageRect.y - 10
 
            popupRect(2) = 570
 
            popupRect(3) = pageRect.y - 55
 
            Set miAnot = jso.AddAnnot
 
            Set props = miAnot.getprops
 
            props.Page = 0
 
            props.Name = "LLOPEZ PROCURADORES, SLP"
 
            props.Type = "FreeText"
 
            props.Rect=popupRect
 
            props.Contents="prueba"
 
      End if
 
miAnot.setProps.props

...sólo deberemos añadir estas instrucciones,:

1
2
3
4
5
6
7
8
9
10
11
Set Aform = CreateObject("AFormAut.App")
 
ex1 = ex1 & "var a = this.getAnnot(i, " & """" & "destinatario" & """" & ");" & vbLf
ex1 = ex1 & "miTexto = a.contents;" & vbLf
ex1 = ex1 & "var spans = new Array();" & vbLf
ex1 = ex1 & "spans[0] = new Object();" & vbLf
ex1 = ex1 & "spans[0].text = miTexto;" & vbLf
ex1 = ex1 & "spans[0].textSize = 7;" & vbLf
ex1 = ex1 & "a.richContents = spans;"
 
Aform.Fields.ExecuteThisJavaScript ex1

Se trata de leer el lenguaje JAVA mediante el método ExecuteThisJavaScript. Recordad que antes deberéis clica en AFormsAut de la librería de Referencias...

Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar