Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents from any .NET(C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Tue Feb 23, 2021 10:16 am

I convert a pptx file to pdf file:
This is my code:

Code: Select all
    Dim ppt = New Spire.Presentation.Presentation()
        ppt.LoadFromFile("D:\1.DTP_Autom\PowerPoit_Demo\Copyshape.pptx")
        ppt.SaveToFile("D:\1.DTP_Autom\PowerPoit_Demo\Copyshape.pdf", Spire.Presentation.FileFormat.PDF)
        System.Diagnostics.Process.Start("D:\1.DTP_Autom\PowerPoit_Demo\Copyshape.pdf")


Result:
2021-02-23 17-11-55.png


Why convert pptx to pdf missing image?
You do not have the required permissions to view the files attached to this post.

daitranthanhhoa
 
Posts: 28
Joined: Mon Sep 19, 2016 3:04 am

Wed Feb 24, 2021 1:52 am

Hello,

Thanks for your inquiry.
I simulated a PPT file and then tested your code with the latest Spire.Presentation Pack Hotfix Version:6.2.2, but I did not reproduce your issue.

To help us investigate further, please provide us with your input file. Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1573
Joined: Tue Jul 09, 2019 2:22 am

Wed Feb 24, 2021 7:49 am

This is my test file: https://drive.google.com/file/d/1R7Mtgg ... sp=sharing
I install package [FreeSpire.Office.4.3.1] from [Manage Nuget Package for Solution] in Visual Studio.

I had try remove [Spire.Presentation.dll] in [References]. and run install [Install-Package Spire.Presentation -Version 6.2.2]. It still not ok,
And

daitranthanhhoa
 
Posts: 28
Joined: Mon Sep 19, 2016 3:04 am

Wed Feb 24, 2021 9:54 am

Hello,

Thanks for your sharing.

I downloaded your file and opened it in Microsoft PowerPoint, but it is not the same as what your screenshot shows. There is no image, but shows "The linked image cannot be displayed", as shown below. For such PPT files, either using Microsoft PowerPoint or our Spire.Presentation to convert it to PDF, there will be no images in the result file.

Open in MS PowerPoint.png

Please check again on your side whether the images in your input file can be displayed normally.

Sincerely,
Rachel
E-iceblue support team
You do not have the required permissions to view the files attached to this post.
User avatar

rachel.lei
 
Posts: 1573
Joined: Tue Jul 09, 2019 2:22 am

Thu Feb 25, 2021 9:47 am

I'm sorry.
I try create file again, but it can't using Spire.Presentation.dll
I try resintall, but it occur error when new object.
Code: Select all
 Dim ppt = New Spire.Presentation.Presentation()

Error: "The type initializer for 'spr䐏' threw an exception."

daitranthanhhoa
 
Posts: 28
Joined: Mon Sep 19, 2016 3:04 am

Thu Feb 25, 2021 10:07 am

Hello,

Thanks for your response.
Please make sure you have added the three dlls (Spire.License.dll, Spire.Pdf.dll, Spire.Presentation.dll) of our Spire.Presentation to your project. I suggest you first remove all the dlls related to our products from your project, and then re-add the three dlls from the same folder of Spire.Presentation package.

If the issue persists, please provide your project to help us investigate further. You could send it to us (support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1573
Joined: Tue Jul 09, 2019 2:22 am

Fri Feb 26, 2021 10:04 am

This is my data created: https://drive.google.com/file/d/1mwoFWr ... sp=sharing
file pptx only show image when exist links images.
This file was created by Sprice:
This is code set image to Rectangle on Template file:
Code: Select all
For Each sp As Spire.Presentation.Shape In newSlide.Shapes
                If sp.Name = "Img" Then
                    sp.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Picture
                    sp.Fill.PictureFill.Picture.Url = "D:\PowerPoit_Demo\t1.png"
                    sp.Fill.PictureFill.FillType = PictureFillType.Stretch
                    Dim bmp = New Bitmap("D:\PowerPoit_Demo\t1.png")
                    sp.Width = bmp.Width
                    sp.Height = bmp.Height
                    Exit For
                End If
            Next

daitranthanhhoa
 
Posts: 28
Joined: Mon Sep 19, 2016 3:04 am

Mon Mar 01, 2021 2:15 am

Hello,

Thanks for your response.
To avoid this issue, please refer to the following code to fill the shape with the embedded image. Feel free to contact us if you have further questions.
Code: Select all
        For Each sp As Spire.Presentation.Shape In newSlide.Shapes
            If sp.Name = "Img" Then
                sp.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Picture
                Dim image As Image = image.FromFile("D:\PowerPoit_Demo\t1.png")
                Dim imageData As IImageData = ppt.Images.Append(image)
                sp.Fill.FillType = FillFormatType.Picture
                sp.Fill.PictureFill.Picture.EmbedImage = imageData
                sp.Fill.PictureFill.FillType = PictureFillType.Stretch
                Dim bmp = New Bitmap("D:\PowerPoit_Demo\t1.png")
                sp.Width = bmp.Width
                sp.Height = bmp.Height
                Exit For
            End If
        Next


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1573
Joined: Tue Jul 09, 2019 2:22 am

Mon Mar 01, 2021 4:35 am

Thank you. It is ok.

daitranthanhhoa
 
Posts: 28
Joined: Mon Sep 19, 2016 3:04 am

Mon Mar 01, 2021 5:37 am

Hello,

Thanks for your feedback.

If you encounter any issues related to our products in the future, just feel free to contact us.

Have a nice day!

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1573
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.Presentation