Android Question Justify Text to add on PDF with PDFWriter or PDFJet

hibrid0

Active Member
Licensed User
Longtime User
Hi guys, I'm here with the noob problems.
I try to add some text to PDF with PDFwriter or PDFJet and I add is a long line.

I try to do a justify function but not work too well.
Justify text with code is not too easy or I'm dont know how using something.
I try for a week and sometimes I lost words, or lost some letters.
Finally I'm here asking for some of help.

B4X:
Sub justificar_izquierda (cadenaj As String, maximo_caracteres1 As Int, maximo_lineas As Int)
    Dim SF As StringFunctions
    Dim listaS As List
    Dim Lista_final As List
    Dim lista3 As List
    Dim cadena_temporal As String
    Dim Cadena_final As String
   
    listaS.Initialize
    Lista_final.Initialize
    lista3.Initialize
   
    SF.Initialize
    listaS= SF.StringToList(cadenaj, False, False)


    For i=0 To listaS.Size -1
        cadena_temporal= listaS.Get(i) & cadena_temporal
   
        If cadena_temporal.Length >= maximo_caracteres1  Then
   
            Lista_final.Add(Cadena_final)
            cadena_temporal=listaS.Get(i)
            Cadena_final=listaS.Get(i)
        Else If cadena_temporal.Length < maximo_caracteres1 Then
            Cadena_final=Cadena_final & listaS.Get(i)    &" "
        End If
       
    Next
   
    If Cadena_final.Length > 0 Then
        Lista_final.Add(Cadena_final)
    End If
   


        For i = 0 To Lista_final.Size -1
            PDF_text(26, Lista_final.Get(i), maximo_caracteres1)
                    pdf_baja=pdf_baja-4
            Log(Lista_final.Get(i))
        Next
   
End Sub
 
Top