Open MingMogul opened 1 month ago
I used it in unity
@MingMogul Unfortunately, I am not quite familiar with Unity. I have created a simple application with C# script. Here are steps:
The project creation process takes quite a while.
Right click on Assets and create a new C# script:
In GameObject menu select create and add some object on scene, foe example Cube:
Drag and drop the script on the created cube object:
Add some Aspose.Words code to the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using Aspose.Words;
public class HelloWorld : MonoBehaviour { // Start is called before the first frame update void Start() { Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.Write("Hello, World!"); doc.Save(@"C:\Temp\out.pdf"); }
// Update is called once per frame
void Update()
{
}
}
6. In project settings check the target .NET version:
![image](https://github.com/aspose-free-consulting/projects/assets/31235892/8ed16e0f-a8ac-4e52-b983-8131a1409a82)
7. Open Visual Studio and create Class Library project targeting the same version of .NET:
![image](https://github.com/aspose-free-consulting/projects/assets/31235892/62c1c680-9d7f-41b8-ba57-1887dde27758)
8. Add reference to Aspose.Words NuGet package and rebuild the project:
![image](https://github.com/aspose-free-consulting/projects/assets/31235892/da176fb1-3b28-44cd-ac73-2392b3eb14fe)
9. Right click on the project in Visual Studio and click Open in Terminal:
![image](https://github.com/aspose-free-consulting/projects/assets/31235892/f30bb0c5-5b4e-4f8c-a072-4142cc69a3d0)
10. Run the following command
dotnet publish -r win-x64
11. *ClassLibraryProjectPath*\bin\Debug\netstandard2.1\win-x64\publish folder contains all the required dlls. Drag and drop them into the Unity project Assets folder. Skip *.json, *.pdb and ClassLibrary1.dll, System.Runtime.dll, System.Threading.Tasks.dll, System.Text.Encoding.dll, System.Reflection.Primitives.dll, System.Reflection.Emit.ILGeneration.dll, System.Reflection.Emit.dll, System.Text.Encoding.CodePages.dll files.
Run the project and that is it, the image is generated.
Here is the final list of dlls in the Assets folder:
Aspose.Words.dll Aspose.Words.Pdf2Word.dll libSkiaSharp.dll Microsoft.Win32.Registry.dll SkiaSharp.dll System.Buffers.dll System.IO.dll System.Memory.dll System.Numerics.Vectors.dll System.Reflection.dll System.Runtime.CompilerServices.Unsafe.dll System.Security.AccessControl.dll System.Security.Principal.Windows.dll
Please note, this was my first experience with Unity.
I view word conversion pdf by demo
doc.Save(ArtifactsDir + "Document.ConvertToPdf.pdf");
This sentence hint I PlatformNotSupportedException: Operation is not supported on this platform.
Is there anything I didn't import?