اذهب الي المحتوي
أوفيسنا

تحويل ملفات PDF إلى صور عن طريق الكود VBA Access


walid7799

الردود الموصى بها

السلام عليكم ورحمة الله وبركاته

الاساتذة الكبار وأصحاب الخبرة فى المنتدى الرائع أوفيسنا

جعله الله منارة للعلم

بحث كثيرا عن موديول أو كود جاهز على المنتديات المهتمة بالبرمجة واللغات عن كود لتحويل مجلد فى مدلد ODF ولكن فشلت من كثرة البحث

هل يمكن عمل مديول لتحويل مجلد PDf إلى صور مع تغيير الاسم وامسار

وشكراً لحسن تعاونكم مستقبلاً

رابط هذا التعليق
شارك

عثرت لك على هذا .. ولم اجربه

Sub SavePDFAsPng(sPathToPDF As String, sPathToPNG As String)

    Dim oPres As Presentation
    Dim oSh As Shape
    
    ' Height/Width are hardcoded here
    ' You could get trickier and bring the PDF into any presentation
    ' once to get its proportions, delete it, set the slide size to the same
    ' proportions, then re-insert the PDF
    Dim sngWidth As Single
    Dim sngHeight As Single
    sngWidth = 612
    sngHeight = 792
    
    Set oPres = Presentations.Add
    With oPres
        With .PageSetup ' set it to 8.5x11
            .SlideHeight = sngHeight  ' 11in * 72 points per inch
            .SlideWidth = sngWidth
        End With
        .Slides.AddSlide 1, .SlideMaster.CustomLayouts(1)
        With .Slides(1)
            Set oSh = .Shapes.AddOLEObject(0, 0, sngWidth, sngHeight, , sPathToPDF)
            Call .Export(sPathToPNG, "PNG")
        End With
        .Saved = True
        .Close
        
    End With
    
    
End Sub

Sub TestSavePDFAsPng()

 Call SavePDFAsPng("C:\Temp\MyTest.pdf", "C:\Temp\MyTest.PNG")
End Sub

 

رابط هذا التعليق
شارك

3 ساعات مضت, ابوخليل said:

عثرت لك على هذا .. ولم اجربه

Sub SavePDFAsPng(sPathToPDF As String, sPathToPNG As String)

    Dim oPres As Presentation
    Dim oSh As Shape
    
    ' Height/Width are hardcoded here
    ' You could get trickier and bring the PDF into any presentation
    ' once to get its proportions, delete it, set the slide size to the same
    ' proportions, then re-insert the PDF
    Dim sngWidth As Single
    Dim sngHeight As Single
    sngWidth = 612
    sngHeight = 792
    
    Set oPres = Presentations.Add
    With oPres
        With .PageSetup ' set it to 8.5x11
            .SlideHeight = sngHeight  ' 11in * 72 points per inch
            .SlideWidth = sngWidth
        End With
        .Slides.AddSlide 1, .SlideMaster.CustomLayouts(1)
        With .Slides(1)
            Set oSh = .Shapes.AddOLEObject(0, 0, sngWidth, sngHeight, , sPathToPDF)
            Call .Export(sPathToPNG, "PNG")
        End With
        .Saved = True
        .Close
        
    End With
    
    
End Sub

Sub TestSavePDFAsPng()

 Call SavePDFAsPng("C:\Temp\MyTest.pdf", "C:\Temp\MyTest.PNG")
End Sub

 

بعد البحث والتحري .. قمت بتجربة هذا الكود .. 

فظهر لي أنه مصمم لبرنامج الباوربوينت وليس للأكسس .. 

جربت إضافة مكتبة الباوربوينت للأكسس لكن لازالت رسالة الخطأ تظهر ..

وعندما نقلته للباوربويت اشتغل ولله الحمد .. ولكنه مصمم ليحفظ الصفحة الأولى من ملف ال PDF فقط 🙂 

  • Thanks 1
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information