[SerializableAttribute()][DataContractAttribute()]public enum PdfDocumentType
| Value | Member | Description |
|---|---|---|
| 0 |
The target document should be PDF version 1.4. PDF is generally not suited for long term preservation. The PDF format may contain resources (such as fonts) that may not exist on the viewing machine. As a result, font substitution may occur resulting in a document that may not look exactly like the original version. | |
| 1 | PdfA |
The target document should be PDF/A-1b. PDF/A-1b is a subset of PDF obtained by leaving out PDF features not suited to long-term archiving. The resulting document is guaranteed to look exactly like the original version when viewed on the target machine. Saving with PDF/A document type may result in larger output file sizes. |
| 2 | Pdf12 |
The target document should be PDF version 1.2. PDF is generally not suited for long term preservation. The PDF format may contain resources (such as fonts) that may not exist on the viewing machine. As a result, font substitution may occur resulting in a document that may not look exactly like the original version. |
| 3 | Pdf13 |
The target document should be PDF version 1.3. PDF is generally not suited for long term preservation. The PDF format may contain resources (such as fonts) that may not exist on the viewing machine. Hence font substitution may occur resulting in a document that may not look exactly like the original version. |
| 4 | Pdf15 |
The target document should be PDF version 1.5. PDF is generally not suited for long term preservation. The PDF format may contain resources (such as fonts) that may not exist on the viewing machine. As a result font substitution may occur resulting in a document that may not look exactly like the original version. |
| 5 | Pdf16 |
The target document should be PDF version 1.6. PDF is generally not suited for long term preservation. The PDF format may contain resources (such as fonts) that may not exist on the viewing machine. As a result font substitution may occur resulting in a document that may not look exactly like the original version. |
LEADTOOLS Document Writers can create different types of Adobe PDF documents. You can specify the PDF document type through the use of the PdfDocumentOptions.DocumentType property.
using Leadtools.Document.Writer;using Leadtools.Ocr;using Leadtools;using Leadtools.Codecs;public void PdfDocumentOptionsExample(){var inputFileName = Path.Combine(LEAD_VARS.ImagesDir, "test.docx");var outputFileName = Path.Combine(LEAD_VARS.ImagesDir, "Example.pdf");// Setup a new RasterCodecs objectvar codecs = new RasterCodecs();codecs.Options.RasterizeDocument.Load.Resolution = 300;// Get the number of pages in the input documentvar pageCount = codecs.GetTotalPages(inputFileName);// Create a new instance of the LEADTOOLS Document Writervar docWriter = new DocumentWriter();// Change the PDF optionsvar pdfOptions = docWriter.GetOptions(DocumentFormat.Pdf) as PdfDocumentOptions;pdfOptions.DocumentType = PdfDocumentType.Pdf;pdfOptions.FontEmbedMode = DocumentFontEmbedMode.None;pdfOptions.ImageOverText = false;pdfOptions.Linearized = false;pdfOptions.Title = "Add your title here";pdfOptions.Subject = "Add your subject here";pdfOptions.Keywords = "Add your keywords here";pdfOptions.Author = "Add author name here";pdfOptions.Protected = true;pdfOptions.UserPassword = "User password";pdfOptions.OwnerPassword = "Owner password";pdfOptions.EncryptionMode = PdfDocumentEncryptionMode.RC128Bit;pdfOptions.PrintEnabled = false;pdfOptions.HighQualityPrintEnabled = true;pdfOptions.CopyEnabled = false;pdfOptions.EditEnabled = true;pdfOptions.AnnotationsEnabled = true;pdfOptions.AssemblyEnabled = false;pdfOptions.OneBitImageCompression = OneBitImageCompressionType.Flate;pdfOptions.ColoredImageCompression = ColoredImageCompressionType.FlateJpeg;pdfOptions.QualityFactor = 2;// Use default resolutionpdfOptions.DocumentResolution = 0;pdfOptions.PageRestriction = DocumentPageRestriction.Relaxed;// Setup empty page size (Letter size)pdfOptions.EmptyPageWidth = 8.5;pdfOptions.EmptyPageHeight = 11;pdfOptions.EmptyPageResolution = 300;docWriter.SetOptions(DocumentFormat.Pdf, pdfOptions);// Create a new PDF documentDebug.WriteLine("Creating new PDF document: {0}", outputFileName);docWriter.BeginDocument(outputFileName, DocumentFormat.Pdf);// Loop through all the pagesfor (var pageNumber = 1; pageNumber <= pageCount; pageNumber++){// Get the page as SVGDebug.WriteLine("Loading page {0}", pageNumber);var page = new DocumentWriterSvgPage();page.SvgDocument = codecs.LoadSvg(inputFileName, pageNumber, null);// Add the pageDebug.WriteLine("Adding page {0}", pageNumber);docWriter.AddPage(page);page.SvgDocument.Dispose();}// Finally finish writing the PDF file on diskdocWriter.EndDocument();codecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";}