Thursday, 28 September 2023 08:06

Spire.Office 8.9.3 is released

We are delighted to announce the release of Spire.Office 8.9.3. In this version, Spire.Presentation 8.9.4 supports setting the time for automatic slide switching as well as setting and reading the transparency and brightness of gradient stop styles; Spire.PDF 9.9.9 enhances the conversion from PDF to images and OFD to PDF; Spire.Doc 11.9.19 enhances the conversion from Word and HTML to PDF. Besides, a lot of known issues are fixed successfully in this version. More details are listed below.

In this version, the most recent versions of Spire.Doc, Spire.PDF, Spire.XLS, Spire.Presentation, Spire.Email, Spire.DocViewer, Spire.PDFViewer, Spire.Spreadsheet, Spire.OfficeViewer, Spire.DataExport, Spire.Barcode are included.

DLL Versions:

  • Spire.Doc.dll v11.9.19
  • Spire.Pdf.dll v9.9.9
  • Spire.XLS.dll v13.9.1
  • Spire.Presentation.dll v8.9.4
  • Spire.Email.dll v6.8.0
  • Spire.DocViewer.Forms.dll v8.7.0
  • Spire.PdfViewer.Forms.dll v7.12.0
  • Spire.PdfViewer.Asp.dll v7.12.0
  • Spire.Spreadsheet.dll v7.4.2
  • Spire.OfficeViewer.Forms.dll v8.9.3
  • Spire.Barcode.dll v7.2.1
  • Spire.DataExport.dll v4.9.0
  • Spire.DataExport.ResourceMgr.dll v2.1.0
Click the link to get the version Spire.Office 8.9.3:
More information of Spire.Office new release or hotfix:

Here is a list of changes made in this release

Spire.Presentation

Category ID Description
New feature SPIREPPT-2351 Supports setting the time for automatic slide switching.
Presentation ppt = new Presentation();
ppt.LoadFromFile("input.pptx");
ppt.Slides[0].SlideShowTransition.AdvanceAfterTime = 1000;
ppt.Slides[1].SlideShowTransition.SelectedAdvanceAfterTime = false;
ppt.SaveToFile("output.pptx", FileFormat.Pptx2013);
ppt.Dispose();
New feature SPIREPPT-2353 Optimizes the names of all options under Radial Gradient Style type, marking the original options as deprecated and adding the same options as in MS PowerPoint tools.
Previous options:
FromCorner1
FromCorner2
FromCorner3
FromCorner4
New options:
FromTopLeftCorner
FromBottomLeftCorner
FromTopRightCorner
FromBottomRightCorner
New feature SPIREPPT-2354 Supports setting and reading the transparency and brightness of the gradient stop styles.
Presentation ppt = new Presentation();
ppt.LoadFromFile("input.pptx");
StringBuilder stringBuilder = new StringBuilder();
IAutoShape shape = (ppt.Slides[0].Shapes[0] as GroupShape).Shapes[2] as IAutoShape;
GradientStopCollection stops = shape.Fill.Gradient.GradientStops;
for (int i = 0; i < stops.Count; i++)
{
    float transparency = stops[i].Color.Transparency;
    float brightness = stops[i].Color.Brightness;
    stringBuilder.AppendLine("stops" + i + "transparency: " + transparency + " brightness: " + brightness);
}
File.WriteAllText("output.txt", stringBuilder.ToString());

stops[0].Color.Transparency = 0.5f;
stops[0].Color.Brightness = -0.32f;
ppt.SaveToFile("output.pptx", FileFormat.Auto);
ppt.Dispose();
Bug SPIREPPT-2322 Fixes the issue that the collection of corner coordinates of polygons obtained was incomplete.
Bug SPIREPPT-2323 Fixes the issue that the text direction changed after saving slides to images.
Bug SPIREPPT-2334 Fix the issue that it failed to retrieve connection point coordinates for line connector shapes.

Spire.PDF

Category ID Description
Bug SPIREPDF-6130 Fixes the issue that the program threw "System.StackOverflowException" when converting PDF to images.
Bug SPIREPDF-6219 Fixes the issue that the program threw "System.ArgumentOutOfRangeException" when drawing HTML content.
Bug SPIREPDF-6229 Fixes the issue that the size of split document was incorrect.
Bug SPIREPDF-6245 Fixes the issue that the XFA checkbox form fields couldn't be filled.
Bug SPIREPDF-6254 Fixes the issue that the program threw "System.FormatException" when converting OFD to PDF.
Bug SPIREPDF-6259 Fixes the issue that a part of content lost when printing PDF files.
Bug SPIREPDF-6272 Fixes the issue that the FontSizeAuto property for textbox form fields was incorrect.

Spire.Doc

Category ID Description
Bug SPIREDOC-9455 Fixes the issue that the content was incorrect after adding a footer copied from another document to a document and then converting it to a PDF document.
Bug SPIREDOC-9466 Fixes the issue that extra shapes appeared after loading a document and saving it as a new document.
Bug SPIREDOC-9699 Fixes the issue that the font of a document changed after updating the fields in the document and converting it to PDF.
Bug SPIREDOC-9743 Fixes the issue that extra pictures appeared after loading a document and saving it as a new document.
Bug SPIREDOC-9767 Fixes the issue that recognizing the Latex formula code "therefore" failed.
Bug SPIREDOC-9800 Fixes the issue that the program threw System.StackOverflowException when loading a document.
Bug SPIREDOC-9833 Fixes the issue that the content was garbled after converting Doc documents to PDF documents.
Bug SPIREDOC-9834 Fixes the issue that the program threw System.NullReferenceException when converting Docx documents to PDF documents.
Bug SPIREDOC-9836 Fixes the issue that the program threw System.NullReferenceException when replacing text.
Bug SPIREDOC-9852 Fixes the issue that extra pictures appeared after replacing text and saving the document to PDF.
Bug SPIREDOC-9861 Fixes the issue that the program failed to recognize the "<" MathML format in HTML content.
Bug SPIREDOC-9869 Fixes the issue that pictures were lost after converting an HTML document to a PDF document.
Bug SPIREDOC-9878 Fixes the issue that the symbols were rotated after converting Docx documents to PDF documents.

We would like to inform you that E-iceblue will be on holiday from September 29th to October 6th, 2023 (GMT+8:00), in observance of the Mid-Autumn Festival and China’s National Day.

During the holiday, your email will be received as usual and the urgent problems will be solved as soon as possible by the staffs on duty.

Note: The purchase system will remain available 24 hours a day and 7 days a week. Once you process the order online and finish the payment, the license file will be sent to you automatically by our system.

If you want to obtain a temporary license file to have a better evaluation on our products, please Request a Temporary License for yourself. If you could not request it successfully, please send an email to sales team.

Regular business hours will resume on October 7th, 2023. We apologize for any inconvenience this may cause and sincerely appreciate your understanding and continued support.

Please feel free to contact us via the following emails:

Useful Links Related to Purchase

Purchase Policy:
https://www.e-iceblue.com/Misc/purchase-policies.html

Order Online:
https://www.e-iceblue.com/Download/product-list.html

How to use Coupon Code:
https://www.e-iceblue.com/Tutorials/Licensing/How-to-Use-Coupon-Code.html

How to Request an invoice:
https://www.e-iceblue.com/Tutorials/Purchase/How-to-Request-an-invoice-of-your-order.html

Thursday, 28 September 2023 03:20

Python: Split a PDF File into Multiple PDFs

Large PDF files can sometimes be cumbersome to handle, especially when sharing or uploading them. Splitting a large PDF file into multiple smaller PDFs reduces the file size, making it more manageable and quicker to open and process. In this article, we will demonstrate how to split PDF documents in Python using Spire.PDF for Python.

Install Spire.PDF for Python

This scenario requires Spire.PDF for Python and plum-dispatch v1.7.4. They can be easily installed in your VS Code through the following pip command.

pip install Spire.PDF

If you are unsure how to install, please refer to this tutorial: How to Install Spire.PDF for Python in VS Code

Split a PDF File into Multiple Single-Page PDFs in Python

Spire.PDF for Python offers the PdfDocument.Split() method to divide a multi-page PDF document into multiple single-page PDF files. The following are the detailed steps.

  • Create a PdfDocument object.
  • Load a PDF document using PdfDocument.LoadFromFile() method.
  • Split the document into multiple single-page PDFs using PdfDocument.Split() method.
  • Python
from spire.pdf.common import *
from spire.pdf import *

# Create a PdfDocument object
doc = PdfDocument()
# Load a PDF file
doc.LoadFromFile("Sample.pdf")

# Split the PDF file into multiple single-page PDFs
doc.Split("Output/SplitDocument-{0}.pdf", 1)

# Close the PdfDocument object
doc.Close()

Python: Split a PDF File into Multiple PDFs

Split a PDF File by Page Ranges in Python

To split a PDF file into two or more PDF files by page ranges, you need to create two or more new PDF files, and then import the specific page or range of pages from the source PDF into the newly created PDF files. The following are the detailed steps.

  • Create a PdfDocument object.
  • Load a PDF document using PdfDocument.LoadFromFile() method.
  • Create three PdfDocument objects.
  • Import the first page from the source file into the first document using PdfDocument.InsertPage() method.
  • Import pages 2-4 from the source file into the second document using PdfDocument.InsertPageRange() method.
  • Import the remaining pages from the source file into the third document using PdfDocument.InsertPageRange() method.
  • Save the three documents using PdfDocument.SaveToFile() method.
  • Python
from spire.pdf.common import *
from spire.pdf import *

# Create a PdfDocument object
doc = PdfDocument()
# Load a PDF file
doc.LoadFromFile("Sample.pdf")

# Create three PdfDocument objects
newDoc_1 = PdfDocument()
newDoc_2 = PdfDocument()
newDoc_3 = PdfDocument()

# Insert the first page of the source file into the first document
newDoc_1.InsertPage(doc, 0)

# Insert pages 2-4 of the source file into the second document
newDoc_2.InsertPageRange(doc, 1, 3)

# Insert the rest pages of the source file into the third document
newDoc_3.InsertPageRange(doc, 4, doc.Pages.Count - 1)

# Save the three documents
newDoc_1.SaveToFile("Output1/Split-1.pdf")
newDoc_2.SaveToFile("Output1/Split-2.pdf")
newDoc_3.SaveToFile("Output1/Split-3.pdf")

# Close the PdfDocument objects
doc.Close()
newDoc_1.Close()
newDoc_2.Close()
newDoc_3.Close()

Python: Split a PDF File into Multiple PDFs

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

The editing restriction function is a feature in Word documents that allows users to control and limit the editing capabilities and editable areas. It is commonly used to protect sensitive or important document from unauthorized or substandard modifications. By applying editing restrictions, the document owner can specify what types of changes can be made and which part of the document can be edited to protect the document and facilitate collaborating, information gathering, etc. This article is going to show how to restrict Word document editing and remove document editing restrictions using Spire.Doc for Python in Python programs.

Install Spire.Doc for Python

This scenario requires Spire.Doc for Python and plum-dispatch v1.7.4. They can be easily installed in your VS Code through the following pip command.

pip install Spire.Doc

If you are unsure how to install, please refer to this tutorial: How to Install Spire.Doc for Python in VS Code

Restrict Editing of Entire Word Documents with Passwords

There are four types or editing restrictions in Word documents: No changes (Read only), Tracked changes, Comments, and Filling in forms. Spire.Doc for Python provides the Document.Protect() method set editing restrictions and ProtectionType Enum to represent the restriction types.

Here is a list of the ProtectionType Enum and the corresponding editing restrictions:

Enum Editing Restriction Description
ProtectionType.AllowOnlyReading No changes (Read only) Allow reading only.
ProtectionType.AllowOnlyRevisions Tracked changes Allow tracked changes only.
ProtectionType.AllowOnlyComments Comments Allow comments only.
ProtectionType.AllowOnlyFormFields Filling in forms Allow filling out forms only.
ProtectionType.NoProtection None No restrictions.

The steps for setting editing restrictions with a password on Word documents are as follows:

  • Create an object of Document class.
  • Load a Word document using Document.LoadFromFile() method.
  • Set specified editing restrictions on the document using Document.Protect(type:ProtectionType, password:str) method.
  • Save the document using Document.SaveToFile() method.
  • Python
from spire.doc import *
from spire.doc.common import *

# Create an object of Document class
doc = Document()

# Load a Word document
doc.LoadFromFile("Sample.docx")

# Set the editing restriction type to No changes (Read only)
doc.Protect(ProtectionType.AllowOnlyReading, "password")

# Set the editing restriction type to Tracked changes
# doc.Protect(ProtectionType.AllowOnlyRevisions, "password")

# Set the editing restriction type to Comments
# doc.Protect(ProtectionType.AllowOnlyComments, "password")

# Set the editing restriction type to Filling in forms
# doc.Protect(ProtectionType.AllowOnlyFormFields, "password")

# Save the document
doc.SaveToFile("output/EditingRestrictions.docx")
doc.Close()

Python: Set or Remove Word Document Editing Restrictions

Set Exceptions to Word Document Editing Restrictions

Users can add exceptions (unrestricted areas) when setting editing restrictions on Word documents by inserting permission starting and ending tags. The details steps are as follows:

  • Create an object of Document class.
  • Load a Word document using Document.LoadFromFile() method.
  • Get the first section using Document.Sections.get_Item() method.
  • Create an object of PermissionStart class and an object of PermissionEnd class.
  • Insert the permission start tag and the end tag to the document using Paragraph.ChildObjects.Insert() method and Paragraph.ChildObjects.Add() method.
  • Set the editing restriction using Document.Protect() method.
  • Save the document using Document.SaveToFile() method.
  • Python
from spire.doc import *
from spire.doc.common import *

# Create an object of Document class
doc = Document()

# Load a Word document
doc.LoadFromFile("Sample.docx")

# Get the first section
section = doc.Sections.get_Item(0)

# Create a permission start tag and an end tag
start = PermissionStart(doc, "exception1")
end = PermissionEnd(doc, "exception1")

# Insert the permission start tag and the end tag to the first section
paragraph = section.Paragraphs.get_Item(1)
paragraph.ChildObjects.Insert(0,start)
paragraph.ChildObjects.Add(end)

# Set the editing restriction
doc.Protect(ProtectionType.AllowOnlyReading, "password")

# Save the document
doc.SaveToFile("output/RestrictionException.docx")
doc.Close()

Python: Set or Remove Word Document Editing Restrictions

Remove Editing Restrictions from Word Documents

To remove the editing restrictions of a document, simply set the editing restriction type to no restriction using the Document.Protect() method. The detailed steps are as follows:

  • Create an object of Document class.
  • Load a Word document using Document.LoadFromFile() method.
  • Remove the restriction by setting the restriction type to None using Document.Protect() method.
  • Save the document using Document.SaveToFile() method.
  • Python
from spire.doc import *
from spire.doc.common import *

# Create an object of Document class
doc = Document()

# Load a Word document
doc.LoadFromFile("output/EditingRestrictions.docx")

# Remove the editing restriction by set the restriction type to None
doc.Protect(ProtectionType.NoProtection)

# Save the document
doc.SaveToFile("output/RemoveEditingRestriction.docx")
doc.Close()

Python: Set or Remove Word Document Editing Restrictions

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

We are pleased to announce the release of Spire.Presentation Python 8.9.0. This version adds a method to set custom DPI when saving shapes as images. Besides, it also fixes the issue that the program threw "System.NullReferenceException" when resetting the slide size. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREPPT-2346 Adds a method to set custom DPI when saving shapes as images.
presentation.Slides[0].Shapes.SaveAsImage(0, 300, 300); 
Bug SPIREPPT-2345 Fixes the issue that the program threw "System.NullReferenceException" when resetting the slide size.
Click the link below to get Spire.Presentation for Python 8.9.0:

We are happy to announce the release of Spire.Presentation 8.9.4. This version supports setting the time for automatic slide switching as well as setting and reading the transparency and brightness of gradient stop styles. It also enhances the conversion from slides to pictures. Besides, some known issues are fixed in this version, such as the issue that the collection of corner coordinates of polygons obtained was incomplete. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREPPT-2351 Supports setting the time for automatic slide switching.
Presentation ppt = new Presentation();
ppt.LoadFromFile("input.pptx");
ppt.Slides[0].SlideShowTransition.AdvanceAfterTime = 1000;
ppt.Slides[1].SlideShowTransition.SelectedAdvanceAfterTime = false;
ppt.SaveToFile("output.pptx", FileFormat.Pptx2013);
ppt.Dispose();
New feature SPIREPPT-2353 Optimizes the names of all options under Radial Gradient Style type, marking the original options as deprecated and adding the same options as in MS PowerPoint tools.
Previous options:
FromCorner1
FromCorner2
FromCorner3
FromCorner4
New options:
FromTopLeftCorner
FromBottomLeftCorner
FromTopRightCorner
FromBottomRightCorner
New feature SPIREPPT-2354 Supports setting and reading the transparency and brightness of the gradient stop styles.
Presentation ppt = new Presentation();
ppt.LoadFromFile("input.pptx");
StringBuilder stringBuilder = new StringBuilder();
IAutoShape shape = (ppt.Slides[0].Shapes[0] as GroupShape).Shapes[2] as IAutoShape;
GradientStopCollection stops = shape.Fill.Gradient.GradientStops;
for (int i = 0; i < stops.Count; i++)
{
    float transparency = stops[i].Color.Transparency;
    float brightness = stops[i].Color.Brightness;
    stringBuilder.AppendLine("stops" + i + "transparency: " + transparency + " brightness: " + brightness);
}
File.WriteAllText("output.txt", stringBuilder.ToString());

stops[0].Color.Transparency = 0.5f;
stops[0].Color.Brightness = -0.32f;
ppt.SaveToFile("output.pptx", FileFormat.Auto);
ppt.Dispose();
Bug SPIREPPT-2322 Fixes the issue that the collection of corner coordinates of polygons obtained was incomplete.
Bug SPIREPPT-2323 Fixes the issue that the text direction changed after saving slides to images.
Bug SPIREPPT-2334 Fix the issue that it failed to retrieve connection point coordinates for line connector shapes.
Click the link below to download Spire.Presentation 8.9.4:
More information of Spire.Presentation new release or hotfix:
Wednesday, 27 September 2023 01:15

Python: Convert Images to PDF

Converting multiple images into a single PDF is a convenient and efficient way to organize and share visual content. Whether you have a collection of scanned documents, photographs, or digital images, consolidating them into a single PDF file simplifies the process of archiving, emailing, or distributing them. By merging images into a PDF format, you can preserve image quality, reduce file size, and maintain the sequence of the original images. In this article, you will learn how to convert images to PDF in Python using Spire.PDF for Python.

Install Spire.PDF for Python

This scenario requires Spire.PDF for Python and plum-dispatch v1.7.4. They can be easily installed in your VS Code through the following pip command.

pip install Spire.PDF

If you are unsure how to install, please refer to this tutorial: How to Install Spire.PDF for Python in VS Code

Convert Multiple Images into a Single PDF Document in Python

In order to convert all the images in a folder to a PDF, we iterate through each image, add a new page to the PDF with the same size as the image, and then draw the image onto the new page. The following are the detailed steps.

  • Create a PdfDocument object.
  • Set the page margins to zero using PdfDocument.PageSettings.SetMargins() method.
  • Get the folder where the images are stored.
  • Iterate through each image file in the folder, and get the width and height of a specific image.
  • Add a new page that has the same width and height as the image to the PDF document using PdfDocument.Pages.Add() method.
  • Draw the image on the page using PdfPageBase.Canvas.DrawImage() method.
  • Save the document using PdfDocument.SaveToFile() method.
  • Python
from spire.pdf.common import *
from spire.pdf import *
import os

# Create a PdfDocument object
doc = PdfDocument()

# Set the page margins to 0
doc.PageSettings.SetMargins(0.0)

# Get the folder where the images are stored
path = 'C:/Users/Administrator/Desktop/Images/'
files = os.listdir(path)

# Iterate through the files in the folder
for root, dirs, files in os.walk(path):
    for file in files:

        # Load a particular image 
        image = PdfImage.FromFile(os.path.join(root, file))  #FromFile(os.path.join(root, file))
    
        # Get the image width and height
        width = image.PhysicalDimension.Width
        height = image.PhysicalDimension.Height

        # Add a page that has the same size as the image
        page = doc.Pages.Add(SizeF(width, height))

        # Draw image at (0, 0) of the page
        page.Canvas.DrawImage(image, 0.0, 0.0, width, height)
      
# Save to file
doc.SaveToFile('output/ConvertImagesToPdf.pdf')
doc.Dispose();

Python: Convert Images to PDF

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Images are universally compatible and can be easily shared across various platforms, devices, and applications. By converting PowerPoint slides to images, you can distribute your content effortlessly via email, messaging apps, websites, or social media platforms. This makes your presentation accessible to a wider audience and ensures that it can be viewed by anyone, regardless of the software or device they are using. In this article, we will explain how to convert PowerPoint to images in Python using Spire.Presentation for Python.

Install Spire.Presentation for Python

This scenario requires Spire.Presentation for Python and plum-dispatch v1.7.4. They can be easily installed in your VS Code through the following pip command.

pip install Spire.Presentation

If you are unsure how to install, please refer to this tutorial: How to Install Spire.Presentation for Python in VS Code

Convert PowerPoint Presentation to JPG, PNG or BMP Images in Python

Spire.Presentation for Python offers the ISlide.SaveAsImage() method which enables you to convert the slides in a PowerPoint presentation to image files in formats like PNG, JPG or BMP with ease. The detailed steps are as follows:

  • Create a Presentation object.
  • Load a PowerPoint presentation using Presentation.LoadFromFile() method.
  • Loop through the slides in the presentation.
  • Save each slide to an image stream using ISlide.SaveAsImage() method.
  • Save the image stream to a JPG, PNG or BMP file using Stream.Save() method.
  • Python
from spire.presentation.common import *
from spire.presentation import *

# Create a Presentation object
presentation = Presentation()

# Load a PowerPoint presentation
presentation.LoadFromFile("Sample.pptx")

# Loop through the slides in the presentation
for i, slide in enumerate(presentation.Slides):
    # Specify the output file name
    fileName ="Output/ToImage_ + str(i) + ".png"
    # Save each slide as a PNG image
    image = slide.SaveAsImage()
    image.Save(fileName)
    image.Dispose()

presentation.Dispose()

Python: Convert PowerPoint to Images (PNG, JPG, BMP, SVG)

Convert PowerPoint Presentation to JPG, PNG or BMP Images with a Specific Size in Python

You can convert the slides in a PowerPoint presentation to images with a specific size using ISlide.SaveAsImageByWH() method. The detailed steps are as follows:

  • Create a Presentation object.
  • Load a PowerPoint presentation using Presentation.LoadFromFile() method.
  • Loop through the slides in the presentation.
  • Save each slide to an image stream using ISlide.SaveAsImageByWH() method.
  • Save the image stream to a JPG, PNG or BMP file using Stream.Save() method.
  • Python
from spire.presentation.common import *
from spire.presentation import *

# Create a Presentation object
presentation = Presentation()

# Load a PowerPoint presentation
presentation.LoadFromFile("Sample.pptx")

# Loop through the slides in the presentation
for i, slide in enumerate(presentation.Slides):
    # Specify the output file name
    fileName ="Output/ToImage_" + str(i) + ".png"
    # Save each slide to a PNG image with a size of 700 * 400 pixels
    image = slide.SaveAsImageByWH(700, 400)
    image.Save(fileName)
    image.Dispose()

presentation.Dispose()

Python: Convert PowerPoint to Images (PNG, JPG, BMP, SVG)

Convert PowerPoint Presentation to SVG Images in Python

To convert the slides in a PowerPoint presentation to SVG images, you can use the ISlide.SaveToSVG() method. The detailed steps are as follows:

  • Create a Presentation object.
  • Load a PowerPoint presentation using Presentation.LoadFromFile() method.
  • Enable the Presentation.IsNoteRetained property to retain notes when converting the presentation to SVG files.
  • Loop through the slides in the presentation.
  • Save each slide to an SVG stream using ISlide.SaveToSVG() method.
  • Save the SVG stream to an SVG file using Stream.Save() method.
  • Python
from spire.presentation.common import *
from spire.presentation import *

# Create a Presentation object
presentation = Presentation()

# Load a PowerPoint presentation
presentation.LoadFromFile("Sample.pptx")

# Enable the IsNoteRetained property to retain notes when converting the presentation to SVG files
presentation.IsNoteRetained = True

# Loop through the slides in the presentation
for i, slide in enumerate(presentation.Slides):
    # Specify the output file name
    fileName = "SVG/ToSVG_" + str(i) + ".svg"
    # Save each slide to an SVG image
    svgStream = slide.SaveToSVG()
    svgStream.Save(fileName)

presentation.Dispose()

Python: Convert PowerPoint to Images (PNG, JPG, BMP, SVG)

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Tuesday, 26 September 2023 09:49

Spire.Office for Java 8.9.7 is released

We are delighted to announce the release of Spire.Office for Java 8.9.7. In this version, Spire.Doc for Java optimizes the mechanism for reading documents with existing issues, so that the program throws an exception and terminates when reading such a document to avoid causing memory overflow; Spire.PDF for Java supports converting PDF to SVGZ and comparing PDF documents; Spire.Presentation for Java supports specifying the number of pages when converting PPTX to other document formats. In addition, many known issues are fixed in this version. More details are listed below.

Click the link to download Spire.Office for Java 8.9.7:

Here is a list of changes made in this release

Spire.Doc for Java

Category ID Description
New feature SPIREDOC-9700 Optimizes the mechanism for reading documents with existing issues, so that the program throws an exception and terminates when reading such a document to avoid causing memory overflow.
Bug SPIREDOC-9156 Fixes the issue that finding text using regular expressions failed.
Bug SPIREDOC-9261 Fixes the issue that the emphasis marks were lost when converting Word to PDF.
Bug SPIREDOC-9560 Fixes the issue that <p dir="ltl"> tag in HTML did not take effect when converting HTML to Docx.
Bug SPIREDOC-9752 Fixes the issue that fonts were not correct when converting Word to HTML.
Bug SPIREDOC-9815 Fixes the issue that the chart data in the result file was not correct when converting Word to PDF.

Spire.PDF for Java

Category ID Description
New feature SPIREPDF-6082
SPIREPDF-6178
SPIREPDF-6220
Provides the XlsxSpecialTableLayoutOptions interface to optimize formatting when converting PDF with tables to Excel.
PdfDocument document=new PdfDocument();
document.loadFromFile("input.pdf");
XlsxSpecialTableLayoutOptions options=new XlsxSpecialTableLayoutOptions(false, false, false);
document.getConvertOptions().setPdfToXlsxOptions(options);
document.saveToFile("output.pdf", FileFormat.XLSX);
New feature SPIREPDF-6247 Supports converting PDF to SVGZ.
document.saveToFile("output.svgz", FileFormat.SVGZ);
New feature SPIREPDF-6249 Synchronized the function of comparing the contents of PDF documents to JAVA.
PdfDocument pdf1 = new PdfDocument(inputFile_1);
PdfDocument pdf2 = new PdfDocument(inputFile_2);
PdfComparer compare = new PdfComparer(pdf1, pdf2);
compare.getOptions().setPageRanges(0, pdf1.getPages().getCount() - 1, 0, pdf2.getPages().getCount() - 1);
compare.compare(outputFile);
Bug SPIREPDF-6252 Fixes the issue that the page size is inconsistent after converting PDF to SVG.
Bug SPIREPDF-6276 Fixes the issue that the text is duplicated after converting PDF to PPTX.
Bug SPIREPDF-6280 Fixes the issue that the program threw "PDF file structure is not valid" when loading PDF documents.
Bug SPIREPDF-6281 Fixes the issue that the program threw "NullPointerException" when signing PDF.

Spire.Presentation for Java

Category ID Description
New feature SPIREPPT-2366 Supports specifying the number of pages when converting PPTX to other document formats.
ppt.saveToFile(2,5,outputFile, FileFormat.PDF);
Bug SPIREPPT-2282 Fixes the issue that the application threw a "DocumentEditException" exception when splitting PPTX file.
Bug SPIREPPT-2336 Fixes the issue that the application threw a "Comment by nonexistent author" exception when loading PPTX file.
Bug SPIREPPT-2339 Fixes the issue that the application threw a "NullPointerException" exception when loading PPT file.
Bug SPIREPPT-2340 Fixes the issue that the base64 image data was lost after converting HTML to PPTX.
Bug SPIREPPT-2344 Fixes the issue that the image turned black after converting PPTX to PDF.
Bug SPIREPPT-2347 Fixes the issue that the path of video and image was incorrect after converting PPTX to HTML.
Bug SPIREPPT-2348 Fixes the issue that the application threw an exception and the document format was incorrect after converting PPTX to SVG.

We are excited to announce the release of Spire.PDF for Java 9.9.6. This version supports converting PDF to SVGZ and comparing PDF documents. It also enhances the conversion from PDF to Excel, SVG, and PPTX. Moreover, some known issues are fixed in this version, such as the issue that the program threw "PDF file structure is not valid" when loading PDF documents. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREPDF-6082
SPIREPDF-6178
SPIREPDF-6220
Provides the XlsxSpecialTableLayoutOptions interface to optimize formatting when converting PDF with tables to Excel.
PdfDocument document=new PdfDocument();
document.loadFromFile("input.pdf");
XlsxSpecialTableLayoutOptions options=new XlsxSpecialTableLayoutOptions(false, false, false);
document.getConvertOptions().setPdfToXlsxOptions(options);
document.saveToFile("output.pdf", FileFormat.XLSX);
New feature SPIREPDF-6247 Supports converting PDF to SVGZ.
document.saveToFile("output.svgz", FileFormat.SVGZ);
New feature SPIREPDF-6249 Synchronized the function of comparing the contents of PDF documents to JAVA.
PdfDocument pdf1 = new PdfDocument(inputFile_1);
PdfDocument pdf2 = new PdfDocument(inputFile_2);
PdfComparer compare = new PdfComparer(pdf1, pdf2);
compare.getOptions().setPageRanges(0, pdf1.getPages().getCount() - 1, 0, pdf2.getPages().getCount() - 1);
compare.compare(outputFile);
Bug SPIREPDF-6252 Fixes the issue that the page size is inconsistent after converting PDF to SVG.
Bug SPIREPDF-6276 Fixes the issue that the text is duplicated after converting PDF to PPTX.
Bug SPIREPDF-6280 Fixes the issue that the program threw "PDF file structure is not valid" when loading PDF documents.
Bug SPIREPDF-6281 Fixes the issue that the program threw "NullPointerException" when signing PDF.
Click the link below to download Spire.PDF for Java 9.9.6:
Page 1 of 192