AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1590890
Accepted
sancho.s ReinstateMonicaCellio
sancho.s ReinstateMonicaCellio
Asked: 2020-10-06 04:08:16 +0800 CST2020-10-06 04:08:16 +0800 CST 2020-10-06 04:08:16 +0800 CST

将 Powerpoint 导出为单个 PDF,每页作为图像

  • 772

我有一个PowerPoint演示文稿。我想把它变成PDF。如果我保存副本并使用 PDF,我至少要避免两个问题:

  1. 文本是可选的。这或许可以通过 PDF 文件的安全设置来避免。

  2. 我记得偶尔会看到(我现在无法复制太糟糕了)生成的 PDF 有轻微的排列问题。

避免这些问题的一种方法是将每张幻灯片导出为纯图像。我可以处理那条路线,但有两点使它有点麻烦,我的意思是摆脱:

  1. 从 Powerpoint 导出为 jpg(例如)时,没有选项可以避免导出隐藏的幻灯片(这可以在直接保存为 PDF 时完成)。

  2. 从 Powerpoint 导出为 jpg(例如)时,每张幻灯片都会单独导出。必须手动将所有图像链接到 pdf 中。

有什么方法可以实现我的目标吗? 我想我可以为此编写 VBA 代码,但我不想重新发明轮子。

pdf microsoft-powerpoint
  • 2 2 个回答
  • 505 Views

2 个回答

  • Voted
  1. Steve Rindsberg
    2020-10-08T13:36:44+08:002020-10-08T13:36:44+08:00

    将演示文稿的副本另存为 PowerPoint 图片演示文稿。这将为您提供一个 PPTX,其中每张幻灯片都是原始幻灯片的图像。

    保存时不要覆盖原始演示文稿。幻灯片转换为图像后,您无法再转换回可编辑的幻灯片。

    检查以确保隐藏在原件中的幻灯片仍然隐藏在保存的图片演示中。如果没有,您需要在保存为 PDF 之前再次隐藏它们。

    • 2
  2. Best Answer
    sancho.s ReinstateMonicaCellio
    2020-10-22T04:56:35+08:002020-10-22T04:56:35+08:00

    在史蒂夫林茨伯格的回答中交换评论后,我得出结论,要走的路是使用 VBA(我打算避免)。我在这里发布我使用的代码。在编写代码时,它为添加功能提供了灵活性,例如,不导出隐藏的幻灯片。
    我将图像的串联添加到单个 PDF 文件中(这也可以通过 Adob​​e Acrobat、ImageMagick 的转换等来完成)
    注意ExportAsFixedFormat需要ppFixedFormatIntentPrint,否则输出质量会再次丢失。
    希望这对其他人有用。

    Sub ppt2images(Optional path As String = "")
        '
        ' If not given, use for the output directory the same as in the original presentation
        '
        On Error GoTo Err_ImageSave
    
        ' Set paths and file names
        Dim oPres As Presentation
        Set oPres = ActivePresentation
        Dim sImagePath As String
        Dim sPrefix As String
        sPrefix = Split(oPres.Name, ".")(0)
        If (path = "") Then
            path = oPres.path
        End If
        sImagePath = path & "\" & sPrefix
        If Dir(sImagePath, vbDirectory) <> vbNullString Then
            'MsgBox "Folder " & sImagePath & " exist"
        Else
            MkDir (sImagePath)
        End If
       
        ' Get current resolution
        Dim ps As PageSetup
        Set ps = oPres.PageSetup
        Dim lScaleWidth As Long '* Scale Width
        Dim lScaleHeight As Long '* Scale Height
        lScaleWidth = ps.SlideWidth
        lScaleHeight = ps.SlideHeight
        Dim ar As Double
        ar = lScaleWidth / lScaleHeight
        
        ' Set target resolution
        Dim newWidth As Long '* Scale Width
        Dim newHeight As Long '* Scale Height
        newWidth = 4096
        newHeight = newWidth / ar
        
        ' Create new temporary presentation to add generated images as slides
        Dim oPresTmp As Presentation
        ' Create it as not visible
        Set oPresTmp = Presentations.Add(msoFalse)
        ' Copy page size from the source presentation
        With oPresTmp.PageSetup
            .SlideHeight = oPres.PageSetup.SlideHeight
            .SlideWidth = oPres.PageSetup.SlideWidth
        End With
        Dim oSlideNew As Slide '* Slide Object
        Dim oPic As Shape
    
        ' Export slides
        Dim sImageName As String
        Dim oSlide As Slide '* Slide Object
        Dim img_format As String
        img_format = "png"
        For Each oSlide In oPres.Slides
            With oSlide
                ' If slide is not hidden
                If (.SlideShowTransition.Hidden = msoFalse) Then
                    ' Export slide
                    sImageName = sImagePath & "\" & sPrefix & "-" & Format$(.SlideIndex, "000") & "." & img_format
                    .Export sImageName, img_format, newWidth, newHeight
                    ' Add it to the temporary presentation
                    Set oSlideNew = oPresTmp.Slides.Add(oPresTmp.Slides.Count + 1, ppLayoutBlank)
                    Set oPic = oSlideNew.Shapes.AddPicture(FileName:=sImageName, _
                        LinkToFile:=msoFalse, _
                        SaveWithDocument:=msoTrue, _
                        Left:=0, _
                        Top:=0, _
                        Width:=-1, _
                        Height:=-1)
                        ' width/height of -1 tells PPT to import the image at its "natural" size
                End If
            End With
        Next oSlide
        
        With oPresTmp
            ' Export temp presentation to pdf
            Dim sPDFName As String
            sPDFName = sImagePath & ".pdf"
            .ExportAsFixedFormat sPDFName, ppFixedFormatTypePDF, ppFixedFormatIntentPrint, msoFalse, _
                ppPrintHandoutVerticalFirst, ppPrintOutputSlides, msoFalse
            
            ' Close temp presentation
            .Saved = True
            .Close
        End With
    
    Err_ImageSave:
        If Err <> 0 Then
            MsgBox Err.Description
        End If
    End Sub
    
    • 1

相关问题

  • 具有不同宽度列的文本框

  • 在 MS PowerPoint 中:是否有可能删除所有隐藏的幻灯片?

  • CMYK 打印

  • 将双面扫描的 A3 pdf 裁剪并重新排列为 A4 格式

  • WebBrowser 刷新不会刷新 PDF 缩放级别

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    v15 为什么通过电缆(同轴电缆)的千兆位/秒 Internet 连接不能像光纤一样提供对称速度? 2020-01-25 08:53:31 +0800 CST
  • Martin Hope
    fixer1234 “HTTPS Everywhere”仍然相关吗? 2019-10-27 18:06:25 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve