Accusoft.PdfXpress7.ActiveX
Save PDF as PDF/A-1b

PDF Xpress™ supports saving a PDF document in PDF/A-1b format.

To save a PDF as PDF/A-1b:

  1. Render each page of the source PDF document to an uncompressed image.
    PDF Xpress page render methods render uncompressed images. For optimal file size, we recommend using ImagXpress® to compress the rendered page image.
  2. Use ImagXpress® to compress the rendered page image.
  3. Add the page image to the document to convert.
  4. Set convert options to specify a valid ICC profile and the type as PDF/A-1b.
  5. Save the converted PDF/A-1b document.
VB Example
Copy Code
'This code snippet will demonstrate how to convert and save a PDF to PDF/A-1b
'using ImagXpress to compress the rendered page image.
Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
Private Sub saveAsPDFa1b(ByVal sourceDoc As PdfDocument, ByVal targetDoc As PdfDocument, ByVal iccProfileName As String, ByVal ix As ImagXpress)
        Dim page As Long
        Dim pageImageHandle As Long
        Dim imageHandle As Long

        Dim sourceRenderOptions As New RenderOptions
        sourceRenderOpts.ProduceDibSection = False
        sourceRenderOpts.ViewAnnotationFaces = False
        sourceRenderOpts.ResolutionX = 100
        sourceRenderOpts.ResolutionY = 100

        For page = 0 To originalDocument.DocumentPageCount - 1
            'render each page to an uncompressed Dib
            pageImageHandle = GlobalLock(sourceDoc.RenderPageOptionsToDib(page, pageRenderOpts))
            ix.PageNbr = 1
            ix.hDIB = pageImageHandle

            'Perform Compression using ImagXpress for optimal file size
            'in this instance, we are using TIFF for color images
            If ix.IBPP > 1 Then
                ix.SaveFileType = FT_TIFF_G4
            Else
                'JBIG2 provides better bitonal compression than TIFF.
                ix.SaveFileType = FT_JB2
            End If
            ix.SaveToBuffer = True
            ix.SaveFile()

            imageHandle = GlobalLock(ix.SaveBufferHandle)
            'add the page image to the target doc to be converted
            targetDoc.AddImageFromHandle(page, 0, 0, origPageInfo.MediaWidth, origPageInfo.MediaHeight, PDF_ImageFitNone, imageHandle, 0)
        Next page

        'set convert options to specify a valid ICC profile and set type to PDF/A-1b
        Dim convertOpts As New ConvertOptions
        convertOpts.PdfType = PDF_PdfType_PdfA1b
        convertOpts.IccProfileFilename = iccProfileName
        targetDoc.ConvertToPDFA(convertOpts)

        'save the converted PDF/A-1b document
        Dim saveOpts As New SaveOptions
        saveOpts.FileName = "convertedPDFaSampleDoc.pdf"
        targetDoc.SaveDocument(saveOpts)

    End Sub

 

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback