Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Apr 26, 2024 7:58 am

Hi,

I just wanted to export docx to pdf so installed Spire.Doc on my MacBookPro with:

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

inputFile = "example-docs/document.docx"
outputFile = "document.pdf"

#Create word document
document = Document()
document.LoadFromFile(inputFile)

# Create a ToPdfParameterList object
parameters = ToPdfParameterList()

# Embed all used fonts in Word into PDF
parameters.IsEmbeddedAllFonts = True

#Save the file to a PDF file
document.SaveToFile("WordToPdfWithFontsEmbedded.pdf", parameters, FileFormat.PDF)
document.Close()


but after installing it keeps failing with error:

---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-2-707d9ebcb6c3> in <cell line: 15>()
13
14 # Embed all used fonts in Word into PDF
---> 15 parameters.IsEmbeddedAllFonts = True
16
17 #Save the file to a PDF file

1 frames
/usr/local/lib/python3.10/dist-packages/spire/doc/common/__init__.py in CallCFunction(func, *args, **kwargs)
103 args = list(args) +[data]
104
--> 105 result = func(*args, **kwargs)
106 modified_value = cast(data, POINTER(c_uint64)).contents.value
107 if old_value != modified_value:

RuntimeError: ffi_prep_cif_var failed


I use spire-doc = "^12.4.0" in my project.toml

How can I fix this?

Mickwise
 
Posts: 1
Joined: Fri Apr 26, 2024 7:52 am

Fri Apr 26, 2024 9:53 am

Hi,

Thanks for your inquiry.
To help us do further investigation, please offer your input Word file, you can attach here or send it via email(support@e-iceblue.com). Thanks in advance.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Wed Jul 17, 2024 2:26 am

Hi,

I am glad to inform you that we have just released Spire.Doc for Python version 12.7.1, which addresses the "RuntimeError: ffi_prep_cif_var failed" exception issue.
Please download the new version from the links provided below to test. If the issue persists, please provide the version of your Mac operating system.
Website download link: https://www.e-iceblue.com/Download/Spir ... ython.html
Pypi download link: https://pypi.org/project/Spire.Doc/12.7.1/

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.Doc