Hello, I’m trying to use aspose.words for Net (17.2.0) to make PDF/A-1b compliant PDFs.
I have no issues converting a DOCX to PDF, but I’m stuck trying to figure out how to save the final PDF as PDF/A1-B compliant using the COM within PHP.
Hello, I’m trying to use aspose.words for Net (17.2.0) to make PDF/A-1b compliant PDFs.
I have no issues converting a DOCX to PDF, but I’m stuck trying to figure out how to save the final PDF as PDF/A1-B compliant using the COM within PHP.
Hi,
Thanks for your inquiry.
Aspose.Words.dll can be accessed as a COM object. If you need to use many of the Aspose.Words classes, methods and properties, consider creating a wrapper assembly (using C# or any other .NET programming language), that will help to avoid using Aspose.Words directly from unmanaged code.
A good approach is to develop a .NET assembly that references Aspose.Words and does all the work with it, and only exposes the minimal set of classes and methods to unmanaged code. Your application then should work just with your wrapper library. For example, you can create a wrapper that uses latest Aspose.Words for .NET assembly as follows:
namespace AsposeComWrapper
{
public class Methods
{
public Methods() { }
public void SaveAsPdfA1b(object inPath, object outPath)
{
Document doc = new Document((string)inPath);
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.Compliance = PdfCompliance.PdfA1b;
doc.Save((string)outPath, saveOptions);
}
}
}
Now, you should make your class library signed and visible for COM.
After building the project, you should register the DLL using the following command:
regasm /codebase AsposeComWrapper.dll
Once your helper DLL is registered, you can use it to export Word document to PDF with PdfCompliance.PdfA1b option. Here is sample calling VB code (I am afraid, I am not familiar with PHP):
<%
Dim lic
Set lic = CreateObject("Aspose.Words.License")
lic.SetLicense("C:\temp\Aspose.Words.lic")
Dim comHelper
Set comHelper = CreateObject("AsposeComWrapper.Methods")
comHelper.SaveAsPdfA1b "C:\temp\in.doc", "C:\temp\out.pdf"
%>
Hope, this helps.
Best regards,