Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Optimized PDF to PDF/A 1b conversion problems

$
0
0
Hi Tilal,
I am continuing to evaluate Aspose.Pdf for .NET 10.4.0.
Currently I have slightly modified the code to convert files to pdf/a 1b while  trying to produce the smaller file size possible.
The code used is the following:
static bool ConvetToPdfA(string infile, string outfile)
{
    bool result = false;

    if (File.Exists(outfile))
    {
        File.Delete(outfile);
    }
    Aspose.Pdf.Document document = new Aspose.Pdf.Document(infile);
    try
    {
        document.Optimize();
        Document.OptimizationOptions optimizationOptions = Document.OptimizationOptions.All();
        optimizationOptions.UnembedFonts = false;
        document.OptimizeResources(optimizationOptions);
        result = document.Convert(outfile + ".log.xml", Aspose.Pdf.PdfFormat.PDF_A_1B, Aspose.Pdf.ConvertErrorAction.Delete);
    }
    catch (Exception ex)
    {
        Console.Error.WriteLine("Catched exception " + ex.ToString());
    }
    if (result)
    {
        document.Save(outfile);
    }
    Console.Error.WriteLine( "Conversion " +  (result ? "successful" : "failed") + "\n");
    return result;
}

The three included files were not converted; some lines in conversion report shows that the files as not convertable because of "Font 'font name' is not embedded";  Adobe Acrobat Pro DC instead is capable to successfully convert these files.

There is a way to forcing library during conversion to embed the fonts partially ? I tried to iterate all fonts in the pages before calling the Convert() without success - the fonts are fully embedded, causing the file to grow.

Further, I noted that the previous uploaded file js_api_reference.pdf, is successfully converted to pdf/a 1b and pass Adobe preflight validation, but size grows from less of 4 MBytes to 14 MBytes; there is a way to obtain a pdf/a file of a more reasonable size? I looked over documentation  but have not found hints related to.

Regards.
Carlo


Viewing all articles
Browse latest Browse all 3131

Trending Articles