Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Nov 18, 2024 7:27 am

I am using Spire.PDF for Python and trying to convert PDF file to MS Word DOCX format. I used the code provided in official GitHub repo: Spire.PDF-for-Python/Examples/11_Conversion/ToDocx.py

Code: Select all
from spire.pdf.common import *
from spire.pdf import *

outputFile = "ToDocx.docx"
inputFile = "./Demos/Data/ToDocx.pdf"

# Load a pdf document
inputfile = inputFile
doc = PdfDocument()
doc.LoadFromFile(inputfile)
# Convert to doc file.
doc.SaveToFile(outputFile, FileFormat.DOCX)
doc.Close()


However, when I check the DOCX file, I observe that every line in the PDF is created as a separate text box in MS Word. Can you please tell if Spire.PDF offers any settings by which I can instruct the converter to use flow mode while creating the DOCX file?

Thanks!

ponniah_kameswaran
 
Posts: 1
Joined: Mon Nov 18, 2024 7:19 am

Mon Nov 18, 2024 9:50 am

Hi,

Thanks for your inquiry.
Please refer to code below to convert flow Word. If there's still any issue, please provide your input file for our further investifation. Thanks in advance!

Code: Select all
converter =  PdfToWordConverter("input.docx")
converter.SaveToDocx("output.docx")


Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 409
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.PDF