Convert PDF to HTML in RUBY Throws Exception: Document Part File Cannot Be Written

Hey guys, while trying to upload PDF files I’m getting a new error:

Error: SaveAs. Exception: Document part file cannot be written. When saving the document either output file name should be specified or custom streams should be provided via DocumentPartSavingCallback. Please see documentation for details…

Attached are 4 files we are using to test, with the 4 files we are having the same issue.

Code snippets:

Initializer function:
def initialize(s3_path:)
s3_path = s3_path
AsposeWordsCloud.configure do |config|
config.client_data[‘ClientId’] = CLIENT_ID
config.client_data[‘ClientSecret’] = CLIENT_SECRET
end
words_api = WordsApi.new
bucket = PanopenS3Bucket.name(upload_type: ‘book_media’)
end

Save options function:
def html_save_options_data
HtmlSaveOptionsData.new(
FileName: “#{file_name_without_extension}.html”,
ImagesFolder: ‘images/’,
SaveFormat: ‘html’,
ExportHeadersFootersMode: ‘None’,
ExportFontResources: ‘true’,
FontsFolder: ‘fonts/’,
CssStyleSheetFileName: “#{file_name_without_extension}.css”,
CssStyleSheetType: ‘External’,
DocumentSplitCriteria: ‘PageBreak’
)
end

Main function:
def convert_file_to_html
request = SaveAsRequest.new(name: file_name, save_options_data: html_save_options_data, folder: folder_name)
words_api.save_as(request)
html_file = s3.get_object(bucket: bucket, key: html_file_name_with_folder)
find_s3_items_and_change_permissions
resources = [{name: “#{file_name_without_extension}.css”, position: ‘head’, extension: ‘css’}]
[set_images_path(html_file), folder_name, resources]
end

And here are some logs of the variables used in the code above:
html_save_options_data
{:FileName=“49f26a90-f1c4-406a-b75f-39def4d0fe11-Business.html”,
:SaveFormat=“html”,
:CssStyleSheetFileName=“49f26a90-f1c4-406a-b75f-39def4d0fe11-Business.css”,
:CssStyleSheetType=“External”,
:DocumentSplitCriteria=“PageBreak”,
:ExportFontResources=“true”,
:ExportHeadersFootersMode=“None”,
:FontsFolder=“fonts/”,
:ImagesFolder=“images/”
}

Request:
#<AsposeWordsCloud::SaveAsRequest:0x000055e30613dff0 nameD"49f26a90-f1c4-406a-b75f-39def4d0fe11-Business.Law.CH.03.pdf", save_options_dataD#<AsposeWordsCloud::HtmlSaveOptionsData:0x000055e30613e9a0 file_nameD"49f26a90-f1c4-406a-b75f-39def4d0fe11-Business.html", save_formatD"html", css_style_sheet_file_nameD"49f26a90-f1c4-406a-b75f-39def4d0fe11-Business.css", css_style_sheet_typeD"External", document_split_criteriaD"PageBreak", export_font_resourcesD"true", export_headers_footers_modeD"None", fonts_folderD"fonts/", images_folderD"images/">, folderD"pdfs/49f26a90_f1c4_406a_b75f_39def4d0fe11_business_law_ch_03_pdf/", storageDnil, load_encodingDnil, passwordDnil, fonts_locationDnil>

Folder name:
pdfs/49f26a90_f1c4_406a_b75f_39def4d0fe11_business_law_ch_03_pdf/

File name:
49f26a90-f1c4-406a-b75f-39def4d0fe11-Business.Law.CH.03.pdf

Strategy.and.Systems.Sect.3.pdf (183.1 KB)
Econ.1000.CH01.pdf (198.2 KB)
Econ.1000.CH02.pdf (244.3 KB)
Business.Law.CH.03.pdf (461.4 KB)

@altose871
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): WORDSCLOUD-2487

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.

Hi @tilal.ahmad just wondering if there are any updates and if there is anything I can do to help you speeding up the process just let me know.

Thank you!

@altose871

I am afraid the issue is still unresolved and is currently in the investigation queue. I have requested our team to prioritize this investigation and provide an update/ETA as soon as possible. I will notify you as soon as I get an update.

thank you @tilal.ahmad

1 Like