PdfCompliance Enumeration |
Specifies the PDF standards compliance level.
Namespace: SautinSoft.DocumentAssembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2024.11.20
Syntax public enum PdfCompliance
Public Enumeration PdfCompliance
Members Example See Developer Guide: Creates a new document and saves it as PDF file
Creates a new document and saves it as PDF file using C#
using System.IO;
using SautinSoft.Document;
namespace Example
{
class Program
{
static void Main(string[] args)
{
SaveToPdfFile();
SaveToPdfStream();
}
static void SaveToPdfFile()
{
DocumentCore dc = new DocumentCore();
dc.Content.End.Insert("Hey Guys and Girls!\nFrom file.", new CharacterFormat() { FontColor = Color.Green, Size = 20});
string filePath = @"Result-file.pdf";
dc.Save(filePath, new PdfSaveOptions()
{
Compliance = PdfCompliance.PDF_A1a,
PreserveFormFields = true
});
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(filePath) { UseShellExecute = true });
}
static void SaveToPdfStream()
{
byte[] fileData = null;
string filePath = @"Result-stream.pdf";
DocumentCore dc = new DocumentCore();
dc.Content.End.Insert("Hey Guys and Girls!\nFrom MemoryStream.", new CharacterFormat() { FontColor = Color.Orange, Size = 20 });
using (MemoryStream ms = new MemoryStream())
{
dc.Save(ms, new PdfSaveOptions()
{
PageIndex = 0,
PageCount = 1,
Compliance = PdfCompliance.PDF_A1a
});
fileData = ms.ToArray();
}
File.WriteAllBytes(filePath, fileData);
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(filePath) { UseShellExecute = true });
}
}
}
Creates a new document and saves it as PDF file using VB.Net
Imports System
Imports System.IO
Imports SautinSoft.Document
Module Sample
Sub Main()
SaveToPdfFile()
SaveToPdfStream()
End Sub
Sub SaveToPdfFile()
Dim dc As New DocumentCore()
dc.Content.End.Insert("Hey Guys and Girls!" & vbLf & "From file.", New CharacterFormat() With {
.FontColor = Color.Green,
.Size = 20
})
Dim filePath As String = "Result-file.pdf"
dc.Save(filePath, New PdfSaveOptions() With {
.Compliance = PdfCompliance.PDF_A1a,
.PreserveFormFields = True
})
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(filePath) With {.UseShellExecute = True})
End Sub
Sub SaveToPdfStream()
Dim fileData() As Byte = Nothing
Dim filePath As String = "Result-stream.pdf"
Dim dc As New DocumentCore()
dc.Content.End.Insert("Hey Guys and Girls!" & vbLf & "From MemoryStream.", New CharacterFormat() With {
.FontColor = Color.Orange,
.Size = 20
})
Using ms As New MemoryStream()
dc.Save(ms, New PdfSaveOptions() With {
.PageIndex = 0,
.PageCount = 1,
.Compliance = PdfCompliance.PDF_A1a
})
fileData = ms.ToArray()
End Using
File.WriteAllBytes(filePath, fileData)
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(filePath) With {.UseShellExecute = True})
End Sub
End Module
See Also