Programma di conversione da Immagine a PDF

Contaldo Pixel Luigi

Nuovo Utente
27 Gen 2015
5
0
0
Ciao a tutti,

Nessuno conosce un programma efficente e freeware che converta una serie di file dentro una cartella nei relativi file ( con stesso nome ) in formato PDF ... mi sta venendo il callo all'indice a furia di convertili manualmente


Grazie
LC
 
ho importato un'immagine in Excel 2007, ed ho creato il pdf,
mettendo in un foglio l'elenco dei file,
nel secondo definendo l'area di stampa,
con una piccola macro,
leggendo riga x riga dal primo foglio
si importa l'immagine nel secondo
la si stampa,
si cancella l'immagine
si passa alla riga successiva

ma ... bisogna avere excel
 
ho importato un'immagine in Excel 2007, ed ho creato il pdf,
mettendo in un foglio l'elenco dei file,
nel secondo definendo l'area di stampa,
con una piccola macro,
leggendo riga x riga dal primo foglio
si importa l'immagine nel secondo
la si stampa,
si cancella l'immagine
si passa alla riga successiva

ma ... bisogna avere excel

Andrebbe benissimo, mi manderesti i dettagli della macro, anche in PM se non vuoi renderla pubblica!

Grazie mille
 
questo è il risultato
Cattura1.PNG

nel foglio 1 nella cella A1 deve esserci il path completo (esclusa "\" finale)
dalla cella A2 in poi, l'elenco delle immagini
la prima riga bianca determina la fine del lavoro
il lavoro termina anche se un file non viene trovato
Cattura2.PNG

questa è la macro
Codice:
Sub MyMacro()
    Dim mypath As String
    Dim myfile As String
    Dim myrow  As Integer
    Dim mypic  As String
    Dim myend  As Boolean
    Dim myobj  As Object

    mypath = Sheets("Foglio1").Cells(1, 1) 'riga 1 colonna A
    myrow = 1
    myend = False

    Sheets("Foglio2").Select
    Do While myend = False
    
        myrow = myrow + 1
        mypic = Sheets("Foglio1").Cells(myrow, 1)

        If mypic = "" Then
            myend = True
            MsgBox ("riga bianca" & vbCrLf & "HO FINITO")
            Exit Sub
        End If
        myfile = mypath & "\" & mypic
        If Dir(myfile) = "" Then
            myend = True
            MsgBox (myfile & vbCrLf & "ERRORE : FILE NON TROVATO")
            Exit Sub
        End If
    
        InsertPicture myfile, Range("A1"), True, True
    
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=myfile & ".pdf", _
            Quality:=xlQualityStandard, IncludeDocProperties:=True, _
            IgnorePrintAreas:=False, OpenAfterPublish:=True

        For Each myobj In ActiveSheet.Pictures
            myobj.Delete
        Next myobj
    Loop
End Sub

Sub InsertPicture(PictureFileName As String, TargetCell As Range, _
    CenterH As Boolean, CenterV As Boolean)
' inserts a picture at the top left position of TargetCell
' the picture can be centered horizontally and/or vertically
    Dim p As Object, t As Double, l As Double, w As Double, h As Double
    If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
    If Dir(PictureFileName) = "" Then Exit Sub
    ' import picture
    Set p = ActiveSheet.Pictures.Insert(PictureFileName)
    ' determine positions
    With TargetCell
        t = .Top
        l = .Left
        If CenterH Then
            w = .Offset(0, 1).Left - .Left
            l = l + w / 2 - p.Width / 2
            If l < 1 Then l = 1
        End If
        If CenterV Then
            h = .Offset(1, 0).Top - .Top
            t = t + h / 2 - p.Height / 2
            If t < 1 Then t = 1
        End If
    End With
    ' position picture
    With p
        .Top = t
        .Left = l
    End With
    Set p = Nothing
End Sub


ps
OpenAfterPublish:=False
non apre il pdf
 
Ultima modifica:

Discussioni simili