How to convert Word to PDF/A-1b in C# and VB.NET?
Syncfusion Essential® PDF is a .NET PDF library used to create, read, and edit PDF documents. Using this library, you can convert Word to PDF/A-1b using C# and VB.NET.
Steps to convert Word to PDF/A-1b programmatically:
- Create a new C# Windows Forms application project.
- Install the Syncfusion.DocToPDFConverter.WinForms NuGet package as reference to your .NET Framework application from NuGet.org
- Include the following namespaces in the Form1.Designer.cs file.
C#
using Syncfusion.Pdf; using Syncfusion.DocIO.DLS; using Syncfusion.DocToPDFConverter; using System;
VB.NET
Imports Syncfusion.Pdf Imports Syncfusion.DocIO.DLS Imports Syncfusion.DocToPDFConverter Imports System
- Use the following code snippet to convert Word to PDF/A-1b.
C#
//Loads an existing Word document WordDocument wordDocument = new WordDocument(@"..\..\Data\Essential PDF.docx", FormatType.Docx); //Create an instance of the DocToPDFConverter DocToPDFConverter converter = new DocToPDFConverter(); //Set the conformance for PDF/A-1b conversion converter.Settings.PdfConformanceLevel = PdfConformanceLevel.Pdf_A1B; //Convert Word document into PDF document PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument); //Save the PDF file to file system pdfDocument.Save("Output.pdf"); //Close the PDF document pdfDocument.Close(true); wordDocument.Close();
VB.NET
'Loads an existing Word document Dim wordDocument As WordDocument = New WordDocument("..\..\Data\Essential PDF.docx", FormatType.Docx) 'Create an instance of the DocToPDFConverter Dim converter As DocToPDFConverter = New DocToPDFConverter 'Set the conformance for PDF/A-1b conversion converter.Settings.PdfConformanceLevel = PdfConformanceLevel.Pdf_A1B 'Convert Word document into PDF document Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument) 'Save the PDF file to file system pdfDocument.Save("Output.pdf") 'Close the PDF and word document pdfDocument.Close(True) wordDocument.Close()
A complete working sample can be downloaded from WordToPDFA1b_Sample.zip
By executing the program, you will get the PDF document as follows.
Take a moment to peruse the documentation, where you will find other options like create PDF/A-1b and PDF/X-1a document and features like converting Word to PDF, Excel to PDF, and HTML to PDF with code examples.
Refer here to explore the rich set of Syncfusion Essential® PDF features.
An online sample link to convert PDF to PDF/A-1b standard document.
Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion® license key in your application to use the components without trail message.
Conclusion
I hope you enjoyed learning about how to convert Word to PDF/A-1b in C# and VB.NET.
You can refer to our WinForms PDF feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms PDF documentation to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!