A Stream object where the converted PDF document will be saved to. This Stream object must be initialized before it can be sent into this method and it should remain open for subsequent use.
A member of the PdfConversionConformance enumeration. Specifies the required conformance level of the converted PDF document. Currently, PDF_UA_1 is the only valid option.
Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / ConvertToPDFUA Method / ConvertToPDFUA(Stream,PdfConversionConformance,Int32) Method

ConvertToPDFUA(Stream,PdfConversionConformance,Int32) Method

In This Topic
Converts the currently loaded PDF document to a brand new PDF document that meets the PDF/UA conformance.
Syntax
'Declaration

 

Public Overloads Function ConvertToPDFUA( _

   ByVal Stream As Stream, _

   ByVal Conformance As PdfConversionConformance, _

   Optional ByVal TimeoutMillisec As Integer _

) As GdPictureStatus
public function ConvertToPDFUA( 

    Stream: Stream;

    Conformance: PdfConversionConformance;

    TimeoutMillisec: Integer

): GdPictureStatus; 
public function ConvertToPDFUA( 

   Stream : Stream,

   Conformance : PdfConversionConformance,

   TimeoutMillisec : int

) : GdPictureStatus;

Parameters

Stream
A Stream object where the converted PDF document will be saved to. This Stream object must be initialized before it can be sent into this method and it should remain open for subsequent use.
Conformance
A member of the PdfConversionConformance enumeration. Specifies the required conformance level of the converted PDF document. Currently, PDF_UA_1 is the only valid option.
TimeoutMillisec

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents.

Be aware that the output stream should be open for writing and should be closed/disposed of by the user as well.

Example
How to convert the loaded PDF document to the PDF/UA-1 compliant document using streams.
Dim caption As String = "Example: ConvertToPDFUA"

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()

    Dim sourceDoc As System.IO.Stream = New System.IO.FileStream("test.pdf", System.IO.FileMode.Open)

    Dim status As GdPictureStatus = gdpicturePDF.LoadFromStream(sourceDoc)

    If status = GdPictureStatus.OK Then

        Dim destDoc As System.IO.FileStream = New System.IO.FileStream("converted.pdf", System.IO.FileMode.Create)

        status = gdpicturePDF.ConvertToPDFUA(destDoc, PdfConversionConformance.PDF_UA_1)

        If status = GdPictureStatus.OK Then

            MessageBox.Show("The PDF file has been converted successfully.", caption)

        Else

            MessageBox.Show("The file can't be converted. Status: " + status.ToString(), caption)

        End If

        gdpicturePDF.CloseDocument()

        destDoc.Dispose()

    Else

        MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption)

    End If

    sourceDoc.Dispose()

End Using
string caption = "Example: ConvertToPDFUA";

using (GdPicturePDF gdpicturePDF = new GdPicturePDF())

{

    System.IO.Stream sourceDoc = new System.IO.FileStream("test.pdf", System.IO.FileMode.Open);

    GdPictureStatus status = gdpicturePDF.LoadFromStream(sourceDoc);

    if (status == GdPictureStatus.OK)

    {

        System.IO.FileStream destDoc = new System.IO.FileStream("converted.pdf", System.IO.FileMode.Create);

        status = gdpicturePDF.ConvertToPDFUA(destDoc, PdfConversionConformance.PDF_UA_1);

        if (status == GdPictureStatus.OK)

            MessageBox.Show("The PDF file has been converted successfully.", caption);

        else

            MessageBox.Show("The file can't be converted. Status: " + status.ToString(), caption);

        gdpicturePDF.CloseDocument();

        destDoc.Dispose();

    }

    else

        MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption);

    sourceDoc.Dispose();

}
See Also