Last active
July 9, 2021 06:43
-
-
Save aspose-com-kb/ab0c8dc38404f25dfaf4968e055a611f to your computer and use it in GitHub Desktop.
Convert OTG Graphics Format to PDF in C#. OTG to PDF Converter C#. See Details: https://kb.aspose.com/imaging/net/how-to-convert-otg-to-pdf-in-c-sharp/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
//Add Aspose.Imaging for .NET package reference | |
//Use following namespaces to convert OTG to PDF format | |
using Aspose.Imaging; | |
using Aspose.Imaging.ImageOptions; | |
using Aspose.Imaging.FileFormats.Pdf; | |
namespace ConvertOTGToPDF | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
//Set Aspose license before converting an OTG graphics template to PDF | |
//using Aspose.Imaging for .NET | |
Aspose.Imaging.License AsposeImagingLicense = new Aspose.Imaging.License(); | |
AsposeImagingLicense.SetLicense(@"c:\asposelicense\license.lic"); | |
//Load OTG template to be converted to PDF in a new Image object | |
Image ConvertOTGGraphicsToPDF = Image.Load("Input_Graphics_Template.otg"); | |
//create PdfOptions instance to set properties for output PDF | |
PdfOptions PDFSaveOptions = new PdfOptions(); | |
//set output PDF compliance setting | |
PDFSaveOptions.PdfCoreOptions.PdfCompliance = PdfComplianceVersion.PdfA1a; | |
//set output PDF resolution settings to 72 dpi horizontal and vertical | |
PDFSaveOptions.ResolutionSettings = new ResolutionSetting(72, 72); | |
//specify settings for the meta data of the output PDF file | |
PdfDocumentInfo PDFMetadataInfo = new PdfDocumentInfo(); | |
PDFMetadataInfo.Author = "Author Name"; | |
PDFMetadataInfo.Keywords = "Convert OTG to PDF, OTG to PDF"; | |
PDFMetadataInfo.Subject = "Convert OTG to PDF in C#"; | |
//set PDF document information to the set metadata | |
PDFSaveOptions.PdfDocumentInfo = PDFMetadataInfo; | |
//save converted output PDF file with specified save options | |
ConvertOTGGraphicsToPDF.Save("PDFConvertedFromOTG.pdf", PDFSaveOptions); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment