2X faster development
The ultimate ASP.NET Core UI toolkit to boost your development speed.
The Syncfusion Essential PDF is a .NET Core PDF library used to create, read, and edit PDF documents. Using this library, you can convert PDF to PDF/A-1b, PDF/A-2b, and PDF/A3-b in ASP.NET Core. Steps to convert PDF to PDF/A-1b document in ASP.NET Core using C#
//Substitute the non-embedded fonts. static void LoadedDocument_SubstituteFont(object sender, PdfFontEventArgs args) { //Get the font name. string fontName = args.FontName.Split(',')[0]; //Get the font style. PdfFontStyle fontStyle = args.FontStyle; SKFontStyle sKFontStyle = SKFontStyle.Normal; if (fontStyle != PdfFontStyle.Regular) { if (fontStyle == PdfFontStyle.Bold) { sKFontStyle = SKFontStyle.Bold; } else if (fontStyle == PdfFontStyle.Italic) { sKFontStyle = SKFontStyle.Italic; } else if (fontStyle == (PdfFontStyle.Italic | PdfFontStyle.Bold)) { sKFontStyle = SKFontStyle.BoldItalic; } } SKTypeface typeface = SKTypeface.FromFamilyName(fontName, sKFontStyle); SKStreamAsset typeFaceStream = typeface.OpenStream(); MemoryStream memoryStream = null; if (typeFaceStream != null && typeFaceStream.Length > 0) { //Create a fontData from the type face stream. byte[] fontData = new byte[typeFaceStream.Length - 1]; typeFaceStream.Read(fontData, typeFaceStream.Length); typeFaceStream.Dispose(); //Create a new memory stream from the font data. memoryStream = new MemoryStream(fontData); } //Set the font stream to the event args. args.FontStream = memoryStream; }
A complete work sample can be downloaded from PDFToPDFA1b_Sample.zip. Take a moment to peruse the documentation. You will also 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 to this link to explore the rich set of Syncfusion Essential PDF features. An online sample link to convert PDF to PDF/A-1b standard document.
Note: Starting with v16.2.0.x, if you reference Syncfusion assemblies from the trial setup or the NuGet feed, include a license key in your projects. Refer to this link to learn about generating and registering the Syncfusion license key in your application to use the components without a trail message. Also see: https://help.syncfusion.com/file-formats/pdf/working-with-pdf-conformance https://www.syncfusion.com/kb/9515/how-to-convert-pdf-to-pdf-a-1b-using-c-and-vb-net
|
2X faster development
The ultimate ASP.NET Core UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.