We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Missing support for HTML to PDF/a-3 conversion

We are able to make pdf/a-3 files. We are also able to convert html files to pdf. 

But we are not able to convert html into pdf/a-3.

We also referred to this link: Converting HTML to PDF with IE | Syncfusion

But IEConverterSettings which is supposed to be a part of  Syncfusion.HtmlConverter namespace is not found in Syncfusion.HtmlToPdfConverter.Net.Windows nuget package.


Please guide. Any example code HTML to PDF/a-3 conversion is highly appreciated.



4 Replies 1 reply marked as answer

SN Santhiya Narayanan Syncfusion Team December 30, 2022 05:00 PM UTC

IE rendering engine does not support conversion in .NET Core platform. It will only support in .NET Framework platform.

So you can use blink converter setting in .net core.You can't set conformance directly, but you can apply the conformance to an HTML-converted pdf.


Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/ASP.NETCore1180248503


Please refer below documentation page

https://help.syncfusion.com/file-formats/pdf/working-with-pdf-conformance#pdf-to-pdfa-conversion


Please let us know if you need any further assistance in this.




SH Shubham January 2, 2023 06:57 AM UTC

Hi Santhiya,

Thanks for the reply.

Performance is important aspect in our application. We will consider using string to pdf/a-3 conversion directly for our implementation.


But the file attached fails the A3 compliance test in VeraPDF with the code below:

public static void A3WithEmbeddedFont()

        {

            //Create a new PDF document.

            PdfDocument document = new PdfDocument(PdfConformanceLevel.Pdf_A3B);

            //Add a page to the document.

            PdfPage page = document.Pages.Add();

            //Create PDF graphics for the page.

            PdfGraphics graphics = page.Graphics;


            string fontFile = "Arial.ttf";


            //Read a font file stream.

            Stream fontStream = new MemoryStream(File.ReadAllBytes(fontFile));

            //Create a new PDF true type font instance.

            //PdfFont font = new PdfTrueTypeFont(fontStream, true, PdfFontStyle.Regular, 12,);

            PdfFont font = new PdfTrueTypeFont(fontStream,12, true, true);


            //bool isUnicode = font.Unicode;

            //Draw string to PDF page.

            graphics.DrawString("Hello World!", font, PdfBrushes.Black, PointF.Empty);


            //Save the document.

            MemoryStream memoryStream = new MemoryStream();


            //Save the document.

            document.Save(memoryStream);

            //Close the document.

            document.Close(true);

            WriteStreamToFile(memoryStream);

        }


public static void WriteStreamToFile(MemoryStream stream)

        {

            string fileName ="sync-invoice-" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".pdf";

            var file = File.Create(fileName);

            stream.WriteTo(file);


            file.Close();

            stream.Close();

            Console.WriteLine($"{fileName} created successfully!!!");

        }


We need your support as we are considering Syncfusion PDF as a tool for our application.


Attachment: PDF_not_a3_compliant_in_Verapdf_df61696d.zip


IJ Irfana Jaffer Sadhik Syncfusion Team January 3, 2023 09:51 AM UTC

We suspect that the document contains the trail watermark in it. Due to this, the conformance is Invalid. This is not an issue. To overcome this, we must apply the registration license key to avoid a trial watermark and it will be resolved.

Please use the below code snippet to apply license :

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("Your License Key");


we have attached the output document for your reference:

https://www.syncfusion.com/downloads/support/directtrac/general/pd/Output272525247

Please find the below steps to add licensing to the pdf document

  1. please ensure that you have tried the same way to generate your license key: https://help.syncfusion.com/file-formats/licensing/how-to-generate
  2. After that, use the below code snippet to add licensing in the Generate Pdf code method of your application as follows: https://help.syncfusion.com/file-formats/licensing/how-to-register-in-an-application

Please let us know if you are facing any issues with any of the above steps. We request you try this on your end and let us know the result. If still you are facing any issues, we request you to share more details about the issue like issue screenshots/ documentation/ video demos to understand the issue more clearly and provide you the accurate details.


Marked as answer

SH Shubham January 3, 2023 03:50 PM UTC

Hi Irfana,


Thanks for reply. Your solution made my day. 👌😌😌😌



Loader.
Up arrow icon