Can't build RasterImagesSavingModes value from 'int'

Hello,
I am used to converting PDF to HTML using python via .Net (aspose.pdf == 23.3.0).

pdf_bytes = BytesIO(pdf_recover)
converted_pdf_load = ap.Document(pdf_bytes)
save_options = ap.HtmlSaveOptions()

save_options.raster_images_saving_mode = 2
save_options.parts_embedding_mode = 0 # embed css only

for i in range(len(converted_pdf_load.pages)):
while len(converted_pdf_load.pages[i + 1].resources.images) != 0:
converted_pdf_load.pages[i + 1].resources.images.delete(1)

converted_pdf_load.save(html_file, save_options)

I saw that you have updated 23.9 (Aspose PDF for Python via .NET 23.7)

Problem:When I update my version 23.3 to 23.9 I am getting error

Exception has occurred: TypeError
can't build RasterImagesSavingModes value from 'int'
  File "/home/shahed/Documents/project/ANP/app/anonymization/src/services/rasterimage.py", line 44, in <module>
    saveOptions.raster_images_saving_mode = 2
TypeError: can't build RasterImagesSavingModes value from 'int'

I need help to good way to define the raster_image_saving_mode value
Note: untill 23.7 its working how I define in my code. Version 23.8 and 23.9 throwing the problem.

link: HtmlSaveOptions.RasterImagesSavingModes | Aspose.PDF for .NET API Reference

Thanks,
MD Shaedul Islam

@Md_Shaedul_Islam

Can you please share what type of exception or issue are you facing with the latest version (please share the complete error details and stack trace)? Also, can you please share your sample PDF document with us? We will log an investigation ticket and share the ID with you.

@asad.ali
The exception does not depend on the pdf it’s about the save_options configuration.

save_options.raster_images_saving_mode = 2

Code:

pdf_bytes = BytesIO(pdf_recover)
converted_pdf_load = ap.Document(pdf_bytes)
save_options = ap.HtmlSaveOptions()

save_options.raster_images_saving_mode = 2
save_options.parts_embedding_mode = 0 # embed css only

for i in range(len(converted_pdf_load.pages)):
while len(converted_pdf_load.pages[i + 1].resources.images) != 0:
converted_pdf_load.pages[i + 1].resources.images.delete(1)

converted_pdf_load.save(html_file, save_options)

Error:

Exception has occurred: TypeError
can't build RasterImagesSavingModes value from 'int'
  File "/home/shahed/Documents/project/ANP/app/anonymization/src/services/rasterimage.py", line 44, in <module>
    saveOptions.raster_images_saving_mode = 2
TypeError: can't build RasterImagesSavingModes value from 'int'

@Md_Shaedul_Islam

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFPYTHON-134

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.