my code-
## docx conversion
from spire.pdf.common import *
from spire.pdf import *
# Create an object of the PdfDocument class
doc = PdfDocument()
# Load a PDF document
doc.LoadFromFile("05_YFAA_Protocol_a_SOA_Part_B 1.pdf")
# Convert the PDF document to a Word DOCX file
doc.SaveToFile("ToDocx.docx", FileFormat.DOCX)
# Close the PdfDocument object
doc.Close()
## html conversion
from spire.pdf.common import *
from spire.pdf import *
# Create an object of the PdfDocument class
doc = PdfDocument()
# Load a PDF document
doc.LoadFromFile("05_YFAA_Protocol_a_SOA_Part_B 1.pdf")
# Save the PDF document to HTML format
doc.SaveToFile("PdfToHtml.html", FileFormat.HTML)
doc.Close()
### common error in both the codes
SpireException Traceback (most recent call last)
Cell In[4], line 10
7 doc.LoadFromFile("05_YFAA_Protocol_a_SOA_Part_B 1.pdf")
9 # Convert the PDF document to a Word DOCX file
---> 10 doc.SaveToFile("ToDocx.docx", FileFormat.DOCX)
11 # Close the PdfDocument object
12 doc.Close()
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/plum/function.py:642, in _BoundFunction.__call__(self, *args, **kw_args)
641 def __call__(self, *args, **kw_args):
--> 642 return self.f(self.instance, *args, **kw_args)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/plum/function.py:584, in Function.__call__(self, *args, **kw_args)
581 # Check for the common case that the return type is object. This is
582 # to speed up the common case.
583 if return_type is default_obj_type:
--> 584 return method(*args, **kw_args)
585 else:
586 return _convert(method(*args, **kw_args), return_type)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/spire/pdf/PdfDocument.py:288, in PdfDocument.SaveToFile(self, filename, fileFormat)
285 enumfileFormat:c_int = fileFormat.value
287 GetDllLibPdf().PdfDocument_SaveToFileFF.argtypes=[c_void_p ,c_wchar_p,c_int]
--> 288 CallCFunction(GetDllLibPdf().PdfDocument_SaveToFileFF,self.Ptr, filename,enumfileFormat)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/spire/pdf/common/__init__.py:109, in CallCFunction(func, *args, **kwargs)
107 if old_value != modified_value:
108 info = PtrToStr(modified_value)
--> 109 raise SpireException(info)
110 return result
SpireException: Arg_NullReferenceException: at sprdqa.spra(sprdp3, String, sprdsd[], sprcag, Double, Double, Double, Boolean, sprcdt, Boolean, Boolean) + 0xc0
at sprdpx.spra(sprdsl, String, Boolean) + 0x3fc
at sprdsl.spra(sprdpn, String, sprf4l) + 0x253
at sprdpx.spra(sprf4l, String) + 0x3dd
at sprdpx.sprd(sprf4l) + 0xbd7
at sprdpx.spra(Boolean) + 0xe3
at sprf48.spra(Int32) + 0x1d2
at Spire.Pdf.Conversion.PdfToDocConverter.spra(PdfDocumentBase, Stream, Int32, Int32) + 0x1c1
at Spire.Pdf.PdfDocumentBase.spra(String, Boolean) + 0x191
at Spire.Pdf.PdfDocumentBase.Save(String, FileFormat) + 0xac
at Spire.Pdf.AOT.NLPdfDocument.PdfDocument_SaveToFileFF(IntPtr, IntPtr, Int32, IntPtr) + 0xa1[code][/code]