We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Strange behavior converting DOCX to PDF

Hi,

I ordered the Developer OEM License and tried again the delphi integration (via Crosstalk from Atozed). This works better than the OEM support from delphi (in the evluation period we checked all delphi versions without success).

I can read DOCX and save them again. But I can not save my examples as PDF.

Strange thing: If I first open an Docx from your website than I can save this DOCX as PDF and all other examples, but only if I start with this special file. In the other cases the resulting pdf-files are empty and the app is closed.

procedure DoIt(fn: string);
var
WordApp: ComHelper;
ADoc: Document;
APdfOptions: DocSaveOptions; // PdfSaveOptions;
ALicense: License;
begin
Caption := fn;
Application.ProcessMessages;

CoInitialize(nil);
try

WordApp := ComHelper.Create;
ALicense := License.Create;
ADoc := Document.Create;
try
ALicense.SetLicense(‘Aspose.Total.lic’);

ADoc := WordApp.Open(‘S:\Projekt CS\ims\Diverses\AsposeTool’ + fn + ‘.docx’);
try
ADoc.Save(‘S:\Projekt CS\ims\Diverses\AsposeTool’ + fn + ‘_1.docx’);
ADoc.Save(‘S:\Projekt CS\ims\Diverses\AsposeTool’ + fn + ‘_2.pdf’, SaveFormat.pdf);
except
On E: Exception do
MsgDlg(E.Message);
end;

finally
ADoc.Free;
ALicense.Free;
WordApp.Free;
end;

finally
CoUninitialize;
end;
end;

begin
// THIS WORKS
DoIt(‘test00’);
DoIt(‘test01’);
DoIt(‘test02’);
DoIt(‘test03’);
DoIt(‘test04’);
DoIt(‘test05’);
DoIt(‘test06’);
end;

… same souce
begin
// THIS DOES NOT WORK AND CRASHES AFTER TRYING TO SAVE PDF
DoIt(‘test01’);
DoIt(‘test02’);
DoIt(‘test03’);
DoIt(‘test04’);
DoIt(‘test05’);
DoIt(‘test06’);
end;

So I think there may be an initialization in your file (test00.docx) that is needed for converting the other files. Maybe the problem is Office2016 or the german language support? I tried something without any success, but without debugging it is not easy to localize the problem.

I can send you more files, but I did not know if you know CrossTalk for compiling this example.

PS: I can store my files as RTF but not as XPS!

Best regards
Alexander

Hi Alexander,

Thanks for your inquiry. We have converted the shared documents to Docx and Pdf using Aspose.Words for .NET 16.3.0 and have not found the shared issue. Please use latest version of Aspose.Words for .NET 16.3.0 and let us know how it goes on your side. Moreover, please make sure that you are using the same documents at your side.

Hi,

I am using the lastest Version and using C# it works fine. But using it via Delphi this strange behavior is the result.

Best regards
Alex

Hi Alexander,

Thanks for your feedback. The issue seems not to be related to Aspose.Words. Could you please share some detail about Aspose.Words exception/error while saving test01.docx to Pdf?

It would be great if you please only save the test01.docx to Pdf in your code and share your findings here for our reference. We will then provide you more information about your query.

Is there a Chance of logging aspose?

Hi Alexander,

Thanks for your inquiry. Could you please share the requested detail here for our reference? We need some detail from your side to investigate the issue. Once we have this information, we will setup delphi at our end and investigate the issue. After reproducing this issue on our end, we will log this issue in our issue tracking system.

Thanks for your cooperation.