Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 25

Discussione: Immagine in pdf

  1. #1

    Immagine in pdf

    Ciao a tutti, non riesco ad immettere immagini nei file pdf che creo con la libreria fpdf...Qualcuno può darmi due dritte??

    grazie

  2. #2
    Utente di HTML.it
    Registrato dal
    Feb 2005
    Messaggi
    1,150
    Da quello che so io, le librerie fpdf di Baol permettono di gestire solo immagini .jpg

    Questo è la riga nella libreria fpdf.asp dove viene indicato

    if(xtype=="jpg" || xtype=="jpeg")xinfo=this._parsejpg(xfile);
    else this.Error("Unsupported image file type: " + xtype);
    Io faccio così:
    Dove per numepage, si intende a quale pagina del file pdf metterò l'immagine

    Y=pdf.getY()


    if numepage <> pdf.pageNO() then
    numepage=pdf.pageNO()

    SQLpubb = "SELECT * " _
    & "FROM anagpubb where CODI_BOLL_RISU ="&vn_codibollavvi&" and nume_page="& numepage
    Set rspubb = cnnSearch.Execute(SQLpubb)

    if not rspubb.EOF then
    pdf.SetY(Y)
    pdf.SetX(X+45)

    pdf.Image "pubblicita/file/"&rspubb("DESC_NOME_FILE_rino")&".jpg", X, Y, 0, 50, "JPG"



    pdf.Cell 0,50,"",0,1
    end if
    end if


  3. #3
    grazie mille!...Provo subito!

  4. #4
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    scusate ma fpdf fa visualizzare solo un immagine per pagina pdf?

  5. #5
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    uppettone :

    code:

    codice:
    Set PDF = CreateJsObject("FPDF")
    	pdf.CreatePDF()
    	PDF.SetPath("public/fpdf/")
    	pdf.SetFont "Arial","",16
    	PDF.Open
    	
    	
    
    	PDF.SetAuthor "Arredibombaci"
    	PDF.SetCreator "ASP2PDF"
    	PDF.SetKeywords ""
    	PDF.SetSubject "Catalogo"
    	PDF.SetTitle "Catalogo"
    
    
    
    	Dim I, PartenzaY
    	PartenzaY = 40
    	
    	PDF.AddPage
    	Do While NOT RS.EOF
    	
    	PartenzaY = PartenzaY + 2
    	
    	
    		if rs("gfoto")<>"" then
    		pdf.sety 0
    		pdf.Image "/"&RS("gfoto"),pdf.GetY(),partenzaverticale,grandezzafoto
    		end if
    help please

  6. #6
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    up

  7. #7
    Utente di HTML.it
    Registrato dal
    Feb 2005
    Messaggi
    1,150
    Originariamente inviato da Lino80
    uppettone :

    code:

    codice:
    Set PDF = CreateJsObject("FPDF")
    	pdf.CreatePDF()
    	PDF.SetPath("public/fpdf/")
    	pdf.SetFont "Arial","",16
    	PDF.Open
    	
    	
    
    	PDF.SetAuthor "Arredibombaci"
    	PDF.SetCreator "ASP2PDF"
    	PDF.SetKeywords ""
    	PDF.SetSubject "Catalogo"
    	PDF.SetTitle "Catalogo"
    
    
    
    	Dim I, PartenzaY
    	PartenzaY = 40
    	
    	PDF.AddPage
    	Do While NOT RS.EOF
    	
    	PartenzaY = PartenzaY + 2
    	
    	
    		if rs("gfoto")<>"" then
    		pdf.sety 0
    		pdf.Image "/"&RS("gfoto"),pdf.GetY(),partenzaverticale,grandezzafoto
    		end if
    help please
    Spiega meglio il tuo problema.

  8. #8
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    dovrei stampare in un pdf delle tabelle tipo questa: http://www.emmeci-arredamenti.it/emm...sedute&ok=true

    con il seguente codice della pagina stampa_pdf.asp se aggiungo 3 prodotti nel database, ovvero 3 record, il testo me lo visualizza uno sotto l altro separato, mente le 3 immagini me le sovrappone, non me le mette una sotto l altra:

    codice:
    <%@language=vbscript%>
    
    
    
    
    
    
    
    <%
    	dim rs, sql
    	cont_vero = "true"
    	
    	if stampagiacenza = true then
    	
    		if stampaimmagini = false then
    			SQL = " SELECT * FROM Prodotti WHERE controllostampa = " & cont_vero & "  and Gfoto <> '""' order BY " & ordinedistampa
    			Set RS = Conn.Execute(SQL)
    		else 
    			SQL = " SELECT * FROM Prodotti WHERE controllostampa = " & cont_vero & " order BY " & ordinedistampa
    			Set RS = Conn.Execute(SQL)
    		end if
    	else
    		if stampaimmagini = false then
    			SQL = " SELECT * FROM Prodotti WHERE controllostampa = " & cont_vero & "  and Gfoto <> '""'and (giacenza >0 or giacenzainfinita = true) order BY " & ordinedistampa
    			Set RS = Conn.Execute(SQL)
    		else 
    			SQL = " SELECT * FROM Prodotti WHERE controllostampa = " & cont_vero & " and (giacenza >0 or giacenzainfinita = true)order BY " & ordinedistampa
    			Set RS = Conn.Execute(SQL)
    	end if
    	
    	end if
    	
    
    	Set PDF = CreateJsObject("FPDF")
    	pdf.CreatePDF()
    	PDF.SetPath("public/fpdf/")
    	pdf.SetFont "Arial","",16
    	PDF.Open
    	
    	
    
    	PDF.SetAuthor "Arredibombaci"
    	PDF.SetCreator "ASP2PDF"
    	PDF.SetKeywords ""
    	PDF.SetSubject "Catalogo"
    	PDF.SetTitle "Catalogo"
    
    
    
    	Dim I, PartenzaY
    	PartenzaY = 40
    	
    	PDF.AddPage
    	Do While NOT RS.EOF
    	
    	PartenzaY = PartenzaY + 2
    	
    	
    		if rs("gfoto")<>"" then
    		pdf.sety 0
    		pdf.Image "/"&RS("gfoto"),pdf.GetY(),partenzaverticale,grandezzafoto
    		end if
    	
    	
    	
    	
    	PDF.SetXY partenzaid, PartenzaY - 40
    		PDF.SetFont "", "B", fontgrande
    			PDF.MultiCell 0, 5, RS("id"), 0, 0 , "", 0
    		PDF.SetFont "", ""
    	PDF.SetXY partenzatesto, PartenzaY - 40
    		PDF.SetFont "", "B", fontgrande	
    			PDF.MultiCell 0, 5, RS("PDescrizione"), 0, 0 , "", 0
    		PDF.SetFont "", ""
    		
    		
    	PDF.SetXY partenzatesto, PartenzaY -30
    		PDF.SetFont "", "B", fontmedio
    			PDF.MultiCell 0, 5, RS("Prodotto"), 0, 0 , "", 0
    		PDF.SetFont "", ""
    		
    	PDF.SetFont "", "", fontpiccolo
    	
    	
    	PDF.SetXY partenzatesto, PartenzaY - 20
    	PDF.SetFont "", "B", fontpiccolo
    		PDF.MultiCell 0, 5, "Descrizione: ", 0, "", 0
    	PDF.SetFont "", ""
    	PDF.SetFont "", "", fontpiccolissimo
    	PDF.SetXY partenzatesto, PartenzaY + 4
    	if RS("GDescrizione") <> null then
    		PDF.MultiCell 0, 8, RS("GDescrizione"), 0, "", 0
    	PDF.SetFont "", ""	
    	end if
    	
    	if stamparprezzo = true then
    		PDF.SetXY partenzatesto + distanzacolonne, PartenzaY -10
    		PDF.MultiCell 0, 5,"PCD: "& (RS("RPrezzo")), 0, "", 0
    	end if
    	PDF.SetXY partenzatesto, PartenzaY -10
    		PDF.MultiCell 0, 5,"Prezzo: "& RS("CPrezzo") &" €", 0, "", 0
    	PDF.SetXY partenzatesto + distanzacolonne, PartenzaY + 0
    		PDF.MultiCell 0, 5,"ET: "& RS("PuntiSconto")&" ", 0, "", 0
    	if stampanote = true then
    	PDF.SetFont "", "", fontpiccolissimo
    	PDF.SetFont "", ""
    	end if 
    	PDF.SetXY partenzatesto, PartenzaY + 8
    		PDF.MultiCell 0, 5, "Giacenza: "& RS("giacenza"), 0, "", 0
    	PDF.SetXY partenzatesto + distanzacolonne, PartenzaY + 10
    		PDF.MultiCell 0, 5, "Data: "& strtodata(RS("data")), 0, "", 0
    
    	
    	
    	
    	
    	
    	
    	RS.MoveNext
    	Loop
    
         
    	'PDF.Output
    	PDF.Output Server.MapPath("/public/fpdf/miofile.pdf"), true
    %>
    
    PDF generato correttamente, clicca qui per visualizzarlo.
    esempio per farti visualizzare le immagini sovrapposte: http://www.sitowebflash.com/public/fpdf/miofile.pdf

    Spero di essermi spiegato meglio, grazie

  9. #9
    Utente di HTML.it
    Registrato dal
    Feb 2005
    Messaggi
    1,150
    Sì, ora è più chiaro.
    Purtroppo ho un problemino anche io che devo risolvere a breve. Appena posso gli ho una occhiata.
    Nel frattempo ti posto il codice che utilizzo per inserire immagini pubblicitarie (estratte da un db) in un file pdf

    Spero ti possa dare qualche spunto.




    Y=pdf.getY()

    if numepage <> pdf.pageNO() then
    numepage=pdf.pageNO()

    SQLpubb = "SELECT * " _
    & "FROM anagpubb where CODI_BOLL_RISU ="&vn_codibollavvi&" and nume_page="& numepage
    Set rspubb = cnnSearch.Execute(SQLpubb)

    if not rspubb.EOF then
    pdf.SetY(Y)

    pdf.SetX(X)
    P=0
    P=X + cint("0"&rspubb("NUME_POSI_ORIZ"))
    l=0
    l=0+cint("0"&rspubb("NUME_LUNG_IMAG"))
    a=0
    a=0+cint("0"&rspubb("NUME_ALTE_IMAG"))

    pdf.Image "pubblicita/file/"&rspubb("DESC_NOME_FILE_rino")&".jpg", P, Y, l, a, "JPG"



    pdf.SetY(Y)
    pdf.SetX(X)
    Y=pdf.getY()
    X=pdf.getY()

    pdf.Cell 0,a,"",0,1
    end if
    end if

    Y=pdf.getY()

  10. #10
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    ok grazie.. appena finisco di lavorare lo provo

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.