In This Topic
            
            
            
            		The SDK allows to create PDF documents in compliance with version 1.0-2.0 and PDF/A-1b of PDF specification. It can create searchable PDF documents in vector format and image-only PDF documents.
		
		Each of created PDFs can be secured using ARC4 or AES algorithms. The secured PDF document can be assigned with owner and user passwords, as well as applied with configured access permission rights.
		
		
		Here is C#/VB.NET code that demonstrates how to create a PDF document v1.4 in the memory and save it to a file:
		
		
    
	
	    
	    
public static void CreatePdfDocumentInMemory(Vintasoft.Imaging.ImageCollection images)
{
    // create new PDF document version 1.4 in the memory
    using (Vintasoft.Imaging.Pdf.PdfDocument document = new Vintasoft.Imaging.Pdf.PdfDocument(
        new Vintasoft.Imaging.Pdf.PdfFormat("1.4")))
    {
        // create an empty image
        using (Vintasoft.Imaging.VintasoftImage image = new Vintasoft.Imaging.VintasoftImage(600, 800))
        {
            // add image to PDF document
            document.Pages.Add(image);
        }
        // save document to a file
        document.Save("doc.pdf");
    }
}
	     
	 
 
    
	
	    
	    
Public Shared Sub CreatePdfDocumentInMemory(images As Vintasoft.Imaging.ImageCollection)
    ' create new PDF document version 1.4 in the memory
    Using document As New Vintasoft.Imaging.Pdf.PdfDocument(New Vintasoft.Imaging.Pdf.PdfFormat("1.4"))
        ' create an empty image
        Using image As New Vintasoft.Imaging.VintasoftImage(600, 800)
            ' add image to PDF document
            document.Pages.Add(image)
        End Using
        ' save document to a file
        document.Save("doc.pdf")
    End Using
End Sub
	     
	 
 
		
		
		Here is C#/VB.NET code that demonstrates how to create a PDF/A-1b compliant document in a file:
		
		
    
	
	    
	    
public static void CreatePdfADocumentInFile(string pdfFilename, string pageImage)
{
    // create new PDF document version 1.4
    using (Vintasoft.Imaging.Pdf.PdfDocument document = new Vintasoft.Imaging.Pdf.PdfDocument(
        pdfFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14))
    {
        // create an image
        using (Vintasoft.Imaging.VintasoftImage image = new Vintasoft.Imaging.VintasoftImage(pageImage))
        {
            // add image to PDF document
            document.Pages.Add(image);
        }
        // convert documen to PDF/A-1b
        document.ConvertDocument(Vintasoft.Imaging.Pdf.PdfDocumentConformance.PdfA_1b);
    }
}
	     
	 
 
    
	
	    
	    
Public Shared Sub CreatePdfADocumentInFile(pdfFilename As String, pageImage As String)
    ' create new PDF document version 1.4
    Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14)
        ' create an image
        Using image As New Vintasoft.Imaging.VintasoftImage(pageImage)
            ' add image to PDF document
            document.Pages.Add(image)
        End Using
        ' convert documen to PDF/A-1b
        document.ConvertDocument(Vintasoft.Imaging.Pdf.PdfDocumentConformance.PdfA_1b)
    End Using
End Sub
	     
	 
 
		
		
		Here is C#/VB.NET code that demonstrates how to create an secured PDF document in memory and save it to a file:
		
		
    
	
	    
	    
public static void CreateEncryptedDocument(
    string pdfFilename, 
    Vintasoft.Imaging.ImageCollection images, 
    string password)
{
    // create encryption system 40-bit RC4, password protection
    Vintasoft.Imaging.Pdf.Security.EncryptionSystem encryption = 
        new Vintasoft.Imaging.Pdf.Security.EncryptionSystem(
            Vintasoft.Imaging.Pdf.Security.EncryptionAlgorithm.RC4, 40,
            password, password, 
            Vintasoft.Imaging.Pdf.Security.UserAccessPermissions.AllowAll);
    // create encrypted document
    using (Vintasoft.Imaging.Pdf.PdfDocument document = new Vintasoft.Imaging.Pdf.PdfDocument(
        Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14, encryption))
    {
        // add pages
        foreach (Vintasoft.Imaging.VintasoftImage image in images)
            document.Pages.Add(image);
        // save document
        document.SaveChanges(pdfFilename);
    }
}
	     
	 
 
    
	
	    
	    
Public Shared Sub CreateEncryptedDocument(pdfFilename As String, images As Vintasoft.Imaging.ImageCollection, password As String)
    ' create encryption system 40-bit RC4, password protection
    Dim encryption As New Vintasoft.Imaging.Pdf.Security.EncryptionSystem(Vintasoft.Imaging.Pdf.Security.EncryptionAlgorithm.RC4, 40, password, password, Vintasoft.Imaging.Pdf.Security.UserAccessPermissions.AllowAll)
    ' create encrypted document
    Using document As New Vintasoft.Imaging.Pdf.PdfDocument(Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14, encryption)
        ' add pages
        For Each image As Vintasoft.Imaging.VintasoftImage In images
            document.Pages.Add(image)
        Next
        ' save document
        document.SaveChanges(pdfFilename)
    End Using
End Sub
	     
	 
 
		
		
		Create a searchable PDF document (PDF document with vector graphics)
		For creation of searchable PDF document is necessary to create a new PDF document and draw a document content (text, images, graphics, diagrams, etc) on PDF pages. Detailed information about drawing graphics on PDF page can be found 
here.
		
		
		
		
Create an image-only PDF document
		For creation of an image-only PDF document is necessary to create a new PDF document and add PDF pages, based on images, to PDF document.
		
		
		Here is C#/VB.NET code that demonstrates how to convert a raster image to an image-only PDF document using 
PdfEncoder class:
		
		
    
	
	    
	    
public void CreateImageOnlyPdf(System.IO.Stream stream, Vintasoft.Imaging.VintasoftImage image)
{
    // create new PDF document version 1.4 and use JPEG compression for image
    Vintasoft.Imaging.Codecs.Encoders.PdfEncoder encoder = 
        new Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(true, 
            Vintasoft.Imaging.Codecs.Encoders.PdfImageCompression.Jpeg);
    // set document Title
    encoder.Settings.DocumentTitle = "New PDF document!";
    // add image to PDF document
    encoder.SaveImage(image, stream);
}
	     
	 
 
    
	
	    
	    
Public Sub CreateImageOnlyPdf(stream As System.IO.Stream, image As Vintasoft.Imaging.VintasoftImage)
    ' create new PDF document version 1.4 and use JPEG compression for image
    Dim encoder As New Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(True, Vintasoft.Imaging.Codecs.Encoders.PdfImageCompression.Jpeg)
    ' set document Title
    encoder.Settings.DocumentTitle = "New PDF document!"
    ' add image to PDF document
    encoder.SaveImage(image, stream)
End Sub
	     
	 
 
		
		
		Here is C#/VB.NET code that demonstrates how to convert an image collection to an image-only PDF document using 
PdfEncoder class:
		
		
    
	
	    
	    
public void CreateImageOnlyPdf(System.IO.Stream stream, Vintasoft.Imaging.ImageCollection images)
{
    // create new PDF document version 1.4 and use JPEG compression for image
    Vintasoft.Imaging.Codecs.Encoders.PdfEncoder encoder = 
        new Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(true, 
            Vintasoft.Imaging.Codecs.Encoders.PdfImageCompression.Jpeg);
    // set document Title
    encoder.Settings.DocumentTitle = "New PDF document!";
    // add image to PDF document
    encoder.SaveImages(images, stream);
}
	     
	 
 
    
	
	    
	    
Public Sub CreateImageOnlyPdf(stream As System.IO.Stream, images As Vintasoft.Imaging.ImageCollection)
    ' create new PDF document version 1.4 and use JPEG compression for image
    Dim encoder As New Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(True, Vintasoft.Imaging.Codecs.Encoders.PdfImageCompression.Jpeg)
    ' set document Title
    encoder.Settings.DocumentTitle = "New PDF document!"
    ' add image to PDF document
    encoder.SaveImages(images, stream)
End Sub
	     
	 
 
		
		
		Here is C#/VB.NET code that demonstrates how to convert a raster image to an image-only PDF document using 
PdfDocument class:
		
		
    
	
	    
	    
public void CreateImageOnlyPdf(System.IO.Stream stream, Vintasoft.Imaging.VintasoftImage image)
{
    // create new PDF document version 1.4
    Vintasoft.Imaging.Pdf.PdfDocument document = 
        new Vintasoft.Imaging.Pdf.PdfDocument(
            stream, new Vintasoft.Imaging.Pdf.PdfFormat("1.4"));
    // set document Title
    document.DocumentInformation.Title = "New PDF document!";
    // add image to PDF document using JPEG compression
    document.Pages.Add(image, Vintasoft.Imaging.Pdf.PdfCompression.Jpeg);
    // save changes
    document.SaveChanges();
    // close document
    document.Dispose();
}
	     
	 
 
    
	
	    
	    
Public Sub CreateImageOnlyPdf(stream As System.IO.Stream, image As Vintasoft.Imaging.VintasoftImage)
    ' create new PDF document version 1.4
    Dim document As New Vintasoft.Imaging.Pdf.PdfDocument(stream, New Vintasoft.Imaging.Pdf.PdfFormat("1.4"))
    ' set document Title
    document.DocumentInformation.Title = "New PDF document!"
    ' add image to PDF document using JPEG compression
    document.Pages.Add(image, Vintasoft.Imaging.Pdf.PdfCompression.Jpeg)
    ' save changes
    document.SaveChanges()
    ' close document
    document.Dispose()
End Sub
	     
	 
 
		
		
		Here is C#/VB.NET code that demonstrates how to convert an image collection to an image-only PDF document using 
PdfDocument class:
		
		
    
	
	    
	    
public void CreateImageOnlyPdf(System.IO.Stream stream, Vintasoft.Imaging.ImageCollection images)
{
    // create new PDF document version 1.4
    Vintasoft.Imaging.Pdf.PdfDocument document = 
        new Vintasoft.Imaging.Pdf.PdfDocument(
            stream, new Vintasoft.Imaging.Pdf.PdfFormat("1.4"));
    // set document Title
    document.DocumentInformation.Title = "New PDF document!";
    // for each image in image collection
    for (int i = 0; i < images.Count; i++)
    {
        // add image to PDF document using JPEG compression
        document.Pages.Add(images[i], Vintasoft.Imaging.Pdf.PdfCompression.Jpeg);
    }
    // save changes
    document.SaveChanges();
    // close document
    document.Dispose();
}
	     
	 
 
    
	
	    
	    
Public Sub CreateImageOnlyPdf(stream As System.IO.Stream, images As Vintasoft.Imaging.ImageCollection)
    ' create new PDF document version 1.4
    Dim document As New Vintasoft.Imaging.Pdf.PdfDocument(stream, New Vintasoft.Imaging.Pdf.PdfFormat("1.4"))
    ' set document Title
    document.DocumentInformation.Title = "New PDF document!"
    ' for each image in image collection
    For i As Integer = 0 To images.Count - 1
        ' add image to PDF document using JPEG compression
        document.Pages.Add(images(i), Vintasoft.Imaging.Pdf.PdfCompression.Jpeg)
    Next
    ' save changes
    document.SaveChanges()
    ' close document
    document.Dispose()
End Sub