ConvertToPDFUA(String,PdfConversionConformance) Method
In This Topic
Converts the currently loaded PDF document to a brand new PDF document that meets the PDF/UA conformance.
Syntax
Parameters
- FilePath
- The file path where the converted PDF document will be saved. If the specified file already exists, it will be overwritten.
You are allowed to overwrite the currently opened PDF document only if the document has been loaded into memory setting the LoadInMemory parameter to true in the previously called GdPicturePDF.LoadFromFile method.
- 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.
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.
Example
How to convert the loaded PDF document to the PDF/UA-1 compliant document.
Dim caption As String = "Example: ConvertToPDFUA"
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
status = gdpicturePDF.ConvertToPDFUA("converted.pdf", 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()
Else
MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption)
End If
End Using
string caption = "Example: ConvertToPDFUA";
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.ConvertToPDFUA("converted.pdf", 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();
}
else
MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption);
}
Example
How to convert the loaded PDF document to the PDF/UA-1 compliant document.
Dim caption As String = "Example: ConvertToPDFUA"
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
status = gdpicturePDF.ConvertToPDFUA("converted.pdf", 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()
Else
MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption)
End If
End Using
string caption = "Example: ConvertToPDFUA";
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.ConvertToPDFUA("converted.pdf", 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();
}
else
MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption);
}
See Also