About PDF to PDF/X-1a conversion

Hello,
When i tried to convert pdf to pdf/x-1a, i am not able to convert the exact image color into pdf/x-1a. and i am using aspose.total trail license.

Thank you.

@Goutham0322

Would you please share your sample PDF document and the code snippet with us along with an expected output PDF? We will test the scenario in our environment and address it accordingly.

Sure @asad.ali, should i share it through mail?

Hello Ali,
attached are my outputs and sample code. webpage.pdf is webpage converted to PDF and output_x_1a.pdf is pdf converted to PDF/X-1a.

output_x_1a.pdf (1.6 MB)

webpage.pdf (754.0 KB)

using System;
using System.IO;
using System.Net;
using System.Net.Http;
using Aspose.Pdf;
using Aspose.Pdf.Text;

class Program
{
private static string _dataDir = @"C:\Users\bolle\OneDrive\Desktop\PR1\Outputs";

static void Main(string[] args)
{
    try
    {
        // Set PDF license
        new Aspose.Pdf.License().SetLicense(@"C:\Users\bolle\Downloads\Aspose.Totalfor.NET.lic");

        ConvertHTMLtoPDFAndThenConvertToPDFX1A();
    }
    catch (Exception ex)
    {
        Console.WriteLine($"An error occurred: {ex.Message}");
    }
}

public static void ConvertHTMLtoPDFAndThenConvertToPDFX1A()
{
    const string url = "https://www.evopdf.com";

    try
    {
        Aspose.Pdf.HtmlLoadOptions htmlOptions = new Aspose.Pdf.HtmlLoadOptions(url)
        {
            PageInfo = { Width = 842, Height = 1191, IsLandscape = true }
        };

        Document pdfDocument = new Document(GetContentFromUrlAsStream(url), htmlOptions);
        pdfDocument.Save(_dataDir + "webpage.pdf");
        Console.WriteLine("Webpage converted to PDF.");

        pdfDocument = new Document(_dataDir + "webpage.pdf");
        Aspose.Pdf.PdfFormatConversionOptions pdfX1aOptions = new Aspose.Pdf.PdfFormatConversionOptions(Aspose.Pdf.PdfFormat.PDF_X_1A);

        pdfDocument.Convert(pdfX1aOptions);
        pdfDocument.Save(_dataDir + "output_x_1a.pdf");
        Console.WriteLine("Conversion to PDF/X-1a format successful.");
    }
    catch (IndexOutOfRangeException ex)
    {
        Console.WriteLine($"IndexOutOfRangeException: {ex.Message}");
        Console.WriteLine($"Stack Trace: {ex.StackTrace}");
    }
    catch (Exception ex)
    {
        Console.WriteLine($"An error occurred: {ex.Message}");
    }
}

private static Stream GetContentFromUrlAsStream(string url, ICredentials? credentials = null)
{
    using (var handler = new HttpClientHandler { Credentials = credentials })
    using (var httpClient = new HttpClient(handler))
    {
        return httpClient.GetStreamAsync(url).GetAwaiter().GetResult();
    }
}

}

Thank you.

@Goutham0322

We are checking it and will get back to you shortly.

Thank you @asad.ali .

Hello @asad.ali , hope you are doing good. any luck finding the solution for the above problem.

Thank you.

@Goutham0322

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-55931

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.