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

PDF to PDF-A Failed for documents with multiple fonts and colors

$
0
0
I am trying to convert a PDF document to PDF-A/1b and failed to do with the attached PDF file. Using the code bellow for this purpose:

    public void convertToPdfArchive(byte[] a_byteArrInputDocument) throws Exception {
        if (!ASC_Util.isNullOrEmptyString(m_objSettingVO.getPdfArchiveFormat())) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            ByteArrayInputStream bis = new ByteArrayInputStream(a_byteArrInputDocument);
            com.aspose.pdf.Document obj_PDFDocument = new com.aspose.pdf.Document(bis);
            obj_PDFDocument.convert(new ByteArrayOutputStream(), 
getPdfArchiveFormat(m_objSettingVO.getPdfArchiveFormat()), 
ConvertErrorAction.Delete);
            obj_PDFDocument.save(bos);
            bis.close();
            bos.close();
            m_byteArrOutputDocument = bos.toByteArray();
        } else {
            throw new Exception("PDF Archive format is missing: " + m_objSettingVO.getPdfArchiveFormat());
        }
    }

    private int getPdfArchiveFormat(String a_strPdfArchiveFormat) {
        int i_pdfArchiveFormat = -1;
        if (ASC_ConversionConstants.PDF_A_1A.equalsIgnoreCase(a_strPdfArchiveFormat)) {
            i_pdfArchiveFormat = PdfFormat.PDF_A_1A;
        } else if (ASC_ConversionConstants.PDF_A_1B.equalsIgnoreCase(a_strPdfArchiveFormat)) {
            i_pdfArchiveFormat = PdfFormat.PDF_A_1B;
        } else if (ASC_ConversionConstants.PDF_A_2A.equalsIgnoreCase(a_strPdfArchiveFormat)) {
            i_pdfArchiveFormat = PdfFormat.PDF_A_2A;
        } else if (ASC_ConversionConstants.PDF_A_2B.equalsIgnoreCase(a_strPdfArchiveFormat)) {
            i_pdfArchiveFormat = PdfFormat.PDF_A_2B;
        } else if (ASC_ConversionConstants.PDF_A_2U.equalsIgnoreCase(a_strPdfArchiveFormat)) {
            //i_pdfArchiveFormat = PdfFormat.PDF_A_2B;
        } else if (ASC_ConversionConstants.PDF_A_3A.equalsIgnoreCase(a_strPdfArchiveFormat)) {
            //i_pdfArchiveFormat = PdfFormat.PDF_A_3B;
        } else if (ASC_ConversionConstants.PDF_A_3B.equalsIgnoreCase(a_strPdfArchiveFormat)) {
            i_pdfArchiveFormat = PdfFormat.PDF_A_3B;
        } else if (ASC_ConversionConstants.PDF_A_3U.equalsIgnoreCase(a_strPdfArchiveFormat)) {
            //i_pdfArchiveFormat = PdfFormat.PDF_A_3B;
        }
        return i_pdfArchiveFormat;
    }

Conversion failed and error report is attached. Aspose.PNG list the lib versions.
What is missing which causing the problem?

Viewing all articles
Browse latest Browse all 3131

Trending Articles