Autore Topic: PDF Writer - Stampa nell'ultima pagina  (Letto 597 volte)

Offline domenico

  • Gamberetto
  • *
  • Post: 36
    • Mostra profilo
PDF Writer - Stampa nell'ultima pagina
« il: 27 Febbraio 2017, 17:18:25 »
Buonasera a tutti. C'è la possibilità di stampare un testo solo nell'ultima pagina del file pdf generato da pdf writer?

Offline tornu

  • Gran Maestro dei Gamberi
  • *****
  • Post: 855
    • Mostra profilo
Re:PDF Writer - Stampa nell'ultima pagina
« Risposta #1 il: 27 Febbraio 2017, 21:18:31 »
Ciao domenico,
puoi spiegarti meglio?
Intendi stampare del testo nel piede dell'ultima pagina?
Il software è come il sesso, è meglio quando è libero. (Linus Torvalds)

Offline Golia

  • Senatore Gambero
  • ******
  • Post: 1.298
  • no xe mai massa tardi
    • Mostra profilo
Re:PDF Writer - Stampa nell'ultima pagina
« Risposta #2 il: 28 Febbraio 2017, 14:18:23 »
Ciao
L'unica possibilità (almeno che non mi sfugga qualcosa) è di metterlo in fondo al corpo , funzione Data().
Riassumo..
Funzione Header() ; Intestazione di pagina, stampa il contenuto, in alto, in tutte le pagine
funzione Data() ; Corpo di pagina, stampa il contenuto e in base alla lunghezza crea tot pagine
funzione Footer(); Piè di pagina, in alto, in tutte le pagine

quindi penso che il tuo problema si risolva mettendo in fondo a Data()
Ciao

Offline domenico

  • Gamberetto
  • *
  • Post: 36
    • Mostra profilo
Re:PDF Writer - Stampa nell'ultima pagina
« Risposta #3 il: 01 Marzo 2017, 11:33:17 »
In pratica Ho questo problema nella creazione delle fatture. Quando creo una nuova fattura, anche se ha più pagine, il codice mi mette in automatico il totale, il metodo di pagamento e altre informazioni che vorrei fossero visualizzate solo nell'ultima pagina. Il codice che mi inserisce in ogni pagina è nella sezione "Data()"

Offline tornu

  • Gran Maestro dei Gamberi
  • *****
  • Post: 855
    • Mostra profilo
Re:PDF Writer - Stampa nell'ultima pagina
« Risposta #4 il: 01 Marzo 2017, 20:46:31 »
Sposta il codice che vuoi che ti stampi i dati che ti interessano in Footer()
Il software è come il sesso, è meglio quando è libero. (Linus Torvalds)

Offline Golia

  • Senatore Gambero
  • ******
  • Post: 1.298
  • no xe mai massa tardi
    • Mostra profilo
Re:PDF Writer - Stampa nell'ultima pagina
« Risposta #5 il: 02 Marzo 2017, 08:57:57 »
Se puoi allegare la classe possiamo aiutarti

Offline domenico

  • Gamberetto
  • *
  • Post: 36
    • Mostra profilo
Re:PDF Writer - Stampa nell'ultima pagina
« Risposta #6 il: 02 Marzo 2017, 10:01:00 »
Buongiorno. In pratica la parte che ho indicato sotto ( DA DOVE È COMMENTATO INIZIO PARTE INTERESSATA), la inserisce in ogni pagina ma vorrei la inserisse solo nell'ultima

Codice: [Seleziona]
Public Function Data()
  Dim NrecPieni As Integer
  Dim NrecTot As Integer
  Dim n, k As Integer
  Dim Nca, Nca1 As Integer
  Dim sqlr, sqlrp As String
  Dim MyRSR, MyRSP As Result
  Dim Pqua, Pimp, Ptot, Psco As String
  Dim Fpaga, Fbanc, Fiban, IdPag, Mtex As String
 
  Dim Nfat, Fa1, Fa2 As String
  Dim MT As String
  Dim $Impor As String
 Dim r As Integer
 Dim iDecimali As Integer

  Nfat = fatture.TextArea1.text
 
  If Nfat Then
    nca = InStr(Nfat, "\n")
      If nca > 0 Then
        Fa1 = Mid(Nfat, 1, nca - 1)
        Fa2 = Mid(Nfat, nca)
      Else
        If Len(Nfat) > 62 Then
          Fa1 = Mid(Nfat, 1, InStr(Nfat, " ", 58))
          Fa2 = Mid(Nfat, Len(Fa1) + 1)
        Else
          Fa1 = Nfat
        Endif
      Endif
    Endif
 
  nca = 0
 
  idpag = Fatture.TextBox6.text
 
  sqlrp = "SELECT * FROM pagamenti WHERE pagamento LIKE '%" & idpag & "'"
 
  MyRSP = MODMain.MyConn.Exec(sqlrp)
 
 If MyRSp.Available Then
  fpaga = MyRSP!pagamento
 
  If Fpaga And InStr(Fpaga, "(") Then Fpaga = Mid(Fpaga, 1, InStr(Fpaga, "(") - 1)
 
  Mtex = MyRSP!testo
 
  If UCase(fpaga) = "OMAGGIO" Then
   
    If Mtex Then
    nca = InStr(Mtex, "\n")
   
        If nca > 0 Then
            Fpaga = Fpaga & "  -  " & Mid(mtex, 1, nca - 1)
            nca1 = InStr(Mtex, "\n", nca + 1)
           Fbanc = Mid(mtex, nca, nca1 - nca)
           Fiban = Mid(mtex, nca1)
        Else   
           
            If Len(mtex) > 62 Then
                Fpaga = Fpaga & "  -  " & Mid(mtex, 1, InStr(mtex, " ", 46))         
                fbanc = Mid(mtex, (Len(fpaga) - 11), InStr(mtex, " ", 104) - (Len(fpaga) - 11))
                Fiban = Mid(mtex, Len(fbanc) + (Len(fpaga) - 10))
            Else         
                Fbanc = mtex
            Endif
       
        Endif
       
    Endif

 Else

       If Mtex Then
           nca = InStr(Mtex, "\n")
           
             If nca > 0 Then
                Fbanc = Mid(mtex, 1, nca - 1)
                Fiban = Mid(mtex, nca)
             Else
                   If Len(mtex) > 62 Then
                      fbanc = Mid(mtex, 1, InStr(mtex, " ", 58))
                      Fiban = Mid(mtex, Len(fbanc) + 1)
                   Else
                      Fbanc = mtex
                   Endif
             Endif
        Endif
 
 Endif
 Endif
 
  nca = 0
   
  sqlr = "SELECT * FROM riffatture WHERE idfatture = '" & fatture.IdRec & "'"
 
   MyRSR = MODMain.MyConn.Exec(sqlr)
   If MyRSr.Available Then
   NrecPieni = MyRSR.Count
   MyRSR.MoveFirst
 
  If NrecPieni < 21 Then 
    NrecTot = 20
    maxp = 1
    Else If NrecPieni < 54 Then   '
    NrecTot = 53
    maxp = 2
    Else If NrecPieni < 87 Then
    NrecTot = 86
    maxp = 3
    Else If NrecPieni < 120 Then
    NrecTot = 119
    maxp = 4
    Else If NrecPieni < 153 Then
    NrecTot = 152
    maxp = 5
    Else If NrecPieni < 186 Then
    NrecTot = 185
    maxp = 6
    Else If NrecPieni < 219 Then
    NrecTot = 218
    maxp = 7
    Else If NrecPieni < 252 Then
    NrecTot = 251
    maxp = 8
    Else If NrecPieni < 285 Then
    NrecTot = 284
    maxp = 9
    Else If NrecPieni < 318 Then
    NrecTot = 317
    maxp = 10
    Else If NrecPieni < 351 Then
    NrecTot = 350
    maxp = 11
    Else If NrecPieni < 384 Then
    NrecTot = 383
    maxp = 12
    Else If NrecPieni < 417 Then
    NrecTot = 416
    maxp = 13
    Else
    Message.Error("raggiunto il numero massimo di pagine consentite")
    End If
 
  Me.AddPage()
  Me.Bookmark("Page 1")
 
  Me.SetXY(10, 70)

    Me.Ln()
   
    Me.SetFont("Arial", "", 10)
    Me.SetFillColor(245, 245, 245)

    'inizo parte database ----------------------------------
   
    For n = 1 To NrecPieni
   
      If MyRSR!quantita > 0 Then
            Pqua = Format(MyRSR!quantita, "#####0")
       Else
            Pqua = Null
      Endif

   If MyRSR!prezzo > 0 Then
   
   $Impor = CFloat(MyRSR!prezzo)
   r = InStr($Impor, ".")
   iDecimali = Len($Impor) - r
         
      If iDecimali < 2 Or r = 0 Then iDecimali = 2
     
      Select iDecimali
          Case 2
             Pimp = Format(MyRSR!prezzo, "#####0.00")
          Case 3
             Pimp = Format(MyRSR!prezzo, "#####0.000")
          Case 4
             Pimp = Format(MyRSR!prezzo, "#####0.0000")
          Case 5
             Pimp = Format(MyRSR!prezzo, "#####0.00000")
          Case 6
             Pimp = Format(MyRSR!prezzo, "#####0.000000")
      End Select

   Else
   pimp = Null
   Endif
   
   If MyRSR!sconto > 0 Then
            Psco = Format(MyRSR!sconto, "#####0.00")
       Else
            Psco = Null
      Endif
   
   If MyRSR!subtotale > 0 Then
   Ptot = Format(MyRSR!subtotale, "#####0.00")
   Else
   Ptot = Null
   Endif
   
    Me.Cell(30, 6, MyRSR!codice, False, 0, "C", False)
    Me.Cell(13, 6, Pqua, False, 0, "C", False)
    Me.Cell(95, 6, MyRSR!descrizione, False, 0, "L", False)
    Me.Cell(17, 6, Pimp, False, 0, "C", False)
    Me.Cell(15, 6, Psco, False, 0, "C", False)
    Me.SetFillColor(245, 245, 245)
    Me.Cell(20, 6, Ptot, True, 0, "C", True)
    MyRSR.MoveNext
      Me.Ln()
    Next
   
    If fatture.TextBox5.Text Then ccor = "Consegna: " & UCase(fatture.TextBox5.Text)
    'fine parte database ----------------------------------
   
    If NrecTot > NrecPieni Then
   
    For k = NrecPieni To NrecTot - 1
    Me.Cell(33, 6,, False, 0, "L", False)
    Me.Ln()
    Next
   
    Endif

    ' INIZIO PARTE INTERESSATA

    Me.Ln() '8
             
   Me.Cell(120, 22, "", True, 0, "", False)
    Me.Ln(-3)
    Me.SetX(20)
    Me.SetFillColor(255, 255, 255)                                                               
    Me.SetFont("Arial", "I", 11)
    Me.Cell(45, 6, "Modalita' di Pagamento", False, 0, "C", True)
    Me.SetFont("Arial", "", 10)
   
   Me.Ln()
    Me.SetX(12)                                                                                     
    Me.Cell(116, 6, fpaga, False, 0, "L", False)
   
    Me.Ln(-4)
    Me.SetX(126)
    Me.Cell(15, 6, "", False, 0, "L", False) 'spinta
    Me.Cell(27, 6, "Imponibile ", False, 0, "R", False)
    Me.Cell(32, 6, fatture.textbox10.text & " ", True, 0, "R", False)
   
   
    Me.Ln(10)                                                                           
    Me.SetX(12)
    Me.Cell(116, 6, Fbanc, False, 0, "L", False)
   
   
    Me.Ln()
    Me.SetX(12)
    Me.Cell(116, 6, Fiban, False, 0, "L", False)

    Me.Ln(-9)
    Me.SetX(126)
    Me.Cell(15, 6, "", False, 0, "L", False) 'spinta
    Me.Cell(27, 6, "Tasso Iva % ", False, 0, "R", False)
    Me.Cell(32, 6, fatture.textbox3.text & " ", True, 0, "C", False)
   
   
    Me.Ln(21)
    Me.Cell(120, 22, "", True, 0, "", False)
   
    Me.Ln(-3)
    Me.SetX(22)
    Me.SetFillColor(255, 255, 255)
    Me.SetFont("Arial", "I", 11)
    Me.Cell(45, 6, "Indirizzo di Spedizione", False, 0, "C", True)
   
    Me.Ln(-11)
    Me.SetX(141)
    Me.SetFont("Arial", "", 10)
    Me.Cell(27, 6, "Imposta ", False, 0, "R", False)
    Me.Cell(32, 6, fatture.textbox4.text & " ", True, 0, "R", False)
   
    Me.Ln(17)
    Me.SetX(12)
    Me.Cell(116, 6, Indsp1, False, 0, "L", False)

    Me.Ln(-10)
    Me.SetX(141)
    Me.SetFont("Arial", "", 11)
    Me.Cell(27, 6, "Spese Sped. ", False, 0, "R", False)
    Me.Cell(32, 6, fatture.textbox2.text & " ", True, 0, "R", False)
   
   Me.Ln(15)
    Me.SetX(12)
    Me.Cell(116, 6, Indsp2, False, 0, "L", False)
    Me.Ln()
    Me.SetX(12)
    Me.Cell(116, 6, Ccor, False, 0, "L", False)
   
    Me.Ln(-14)
    Me.SetX(141)
    Me.Cell(27, 6, "Sconto/Coupon ", False, 0, "R", False)
    Me.Cell(32, 6, fatture.textbox8.text & " ", True, 0, "R", False)
   
    Me.Ln(7)
    Me.SetX(141)
    Me.Cell(27, 6, "Acconto ", False, 0, "R", False)
    Me.Cell(32, 6, fatture.textbox9.text & " ", True, 0, "R", False)
   
    Me.Ln(10)
    Me.SetX(141)
    mt = "Totale € " '& Chr(128)
   
    Me.SetFont("Arial", "B", 11)
    Me.Cell(27, 6, mt, False, 0, "R", False)
    Me.Cell(32, 6, fatture.textbox7.text & " ", True, 0, "R", False)
   
    Me.Line(10, 256, 20, 256)
    Me.Line(45, 256, 130, 256)
   
    Me.Line(10, 256, 10, 272)
    Me.Line(130, 256, 130, 272)
   
    Me.Line(10, 272, 130, 272)
   
     Me.Ln(10)
    Me.Cell(120, 16, "", False, 0, "", False)

    Me.Ln(-3)
    Me.SetX(20)
    Me.SetFillColor(255, 255, 255)
    Me.SetFont("Arial", "I", 11)
    Me.Cell(25, 6, "Annotazioni", False, 0, "C", False)
   
    Me.Ln(-3)
    Me.Cell(130, 6, "", False, 0, "L", False) 'spinta
    Me.SetFont("Arial", "", 9)
    Me.Cell(27, 6, "(S.E.& O.) ", False, 0, "R", False)
   
    Me.SetFont("Arial", "", 11)
    Me.Ln()
    Me.Ln(2)
    Me.SetX(12)
    Me.Cell(116, 6, fa1, False, 0, "L", False)
   
 Me.Ln()
    Me.SetX(12)
    Me.Cell(116, 6, fa2, False, 0, "L", False)
    Me.SetFillColor(0, 0, 0)
    Me.SetFont("Arial", "I", 5)
    Me.Code39(135, 260, fatture.TextBNum.text, False, False, 0.4, 8, False)
   
   
Endif
end

Offline Golia

  • Senatore Gambero
  • ******
  • Post: 1.298
  • no xe mai massa tardi
    • Mostra profilo
Re:PDF Writer - Stampa nell'ultima pagina
« Risposta #7 il: 04 Marzo 2017, 11:25:48 »
Ciao
Scusami ma il tempo è quello che è....il tuo codice l'ho appena guardato perchè non avendo il database non posso provarlo, per far presto ti ho modificato un'esempio che avevamo fatto io e Dex.
In allegato c'è più o meno tutto quello che c'è da sapere su pdfwriter, Ho modificato la classe "PDFregistro" che stampa mi sembra tre pagine, nell'ultima vedi che ho inserito qualcosa in fondo.
puoi provare direttamente dall'esempio, il  bottone è "esempio registro merci"
Ciao  :2birre:
« Ultima modifica: 04 Marzo 2017, 11:37:53 da Golia »

Offline domenico

  • Gamberetto
  • *
  • Post: 36
    • Mostra profilo
Re:PDF Writer - Stampa nell'ultima pagina
« Risposta #8 il: 09 Marzo 2017, 09:29:26 »
Grazie 1000 ragazzi. Ho risolto il problema! ;D ;D ;D

Offline Gianluigi

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 4.139
  • Tonno verde
    • Mostra profilo
Re:PDF Writer - Stampa nell'ultima pagina
« Risposta #9 il: 09 Marzo 2017, 16:48:17 »
Potresti per cortesia mettere [Risolto] davanti al primo oggetto del primo post agendo su modifica.
 :ciao:
nuoto in attesa del bacio di una principessa che mi trasformi in un gambero azzurro