Hi,
We are encountering the following error in one of our reports only on the servers when converting a PDF to a Word document. The conversion works fine locally.
Would you please make sure that all fonts are present on the server just like they are in the local environment where no error is occurring? In case issue still persists, please share your sample PDF document with some more details of server and code sample. We will log an investigation ticket and share the ID with you.
Would you please try after installing the particular font on server and check again. If issue still persists, please share some details as per our request in previous message so that we can further proceed accordingly.
Hi @asad.ali I am not sure if it is the same issue or not, if we convert a pdf file to the word document, while the pdf contains a signature, in word document signature moves to another place. Again it works fine locally but not on the servers.
this is the code we are using:
function onActionExportToWord(event) {
var locale = new java.util.Locale('en', 'US');
java.util.Locale.setDefault(locale);
/** @type {Packages.com.aspose.pdf.Document} */
var doc = new Packages.com.aspose.pdf.Document(uploadedFile);
var license = new Packages.com.aspose.pdf.License();
// Call setLicense method to set license
license.setLicense("Aspose.Pdf.Java.lic");
var FILE_DOWLOAD_PATH = plugins.file.getDefaultUploadLocation() + scopes.svyIO.getFileSeperator();
var wordFile = FILE_DOWLOAD_PATH + uploadedFile.getName().replace('.pdf', '.docx');
plugins.webnotificationsToastr.info('This may take several minutes to convert, please wait!');
var options = new Packages.com.aspose.pdf.DocSaveOptions();
// Set output format xlsx and 1 worksheet
options.setFormat(Packages.com.aspose.pdf.DocSaveOptions.DocFormat.DocX);
doc.save(wordFile, options);
var fbytes = plugins.file.readFile(wordFile);
plugins.file.writeFile(uploadedFile.getName().replace('.pdf', '.docx'), fbytes, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document');
}
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): PDFJAVA-45157
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.
No, this ticket only addresses the issue about signature’s position in the output. For the issue mentioned in the first post, have you still faced it after installing the fonts? And can you please share sample file for it as well?
@asad.ali sure attached you can find the document. Can you please advise why both reports work locally but not on the servers considering we uploaded required fonts on the servers?
Apparently, the issue looks related to the missing font that API is not able to find or locate the font in system. Have you tried adding font directories as below?
FontSource fs = new FolderFontSource("{Path tocustomfonts}");
FontRepository.getSources().add(fs);
Hi @asad.ali is following code correct? I mean the classes we are using?
// Use the absolute Linux path to your fonts directory
var fontFolder = '/usr/share/fonts/';
var FolderFontSource = Packages.com.aspose.words.FolderFontSource;
var FontRepository = Packages.com.aspose.words.FontSettings.getDefaultInstance();
// Replace this with your actual path (absolute path required)
// Create font source and add to the repository
var fontSource = new FolderFontSource(fontFolder, true); // true = include subfolders
var sources = FontRepository.getFontsSources();
sources.concat(fontSource)
FontRepository.setFontsSources(sources);
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): PDFJAVA-45160
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.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.