Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active April 21, 2023 06:07
Show Gist options
  • Save aspose-com-kb/26a5ac852b41ca1a8fd16012c2369fd0 to your computer and use it in GitHub Desktop.
Save aspose-com-kb/26a5ac852b41ca1a8fd16012c2369fd0 to your computer and use it in GitHub Desktop.
How to Convert PSD to PDF in C#. For further details: https://kb.aspose.com/psd/net/how-to-convert-psd-to-pdf-in-csharp/
using System;
using Aspose.PSD;
using Aspose.PSD.FileFormats.Pdf;
using Aspose.PSD.FileFormats.Psd;
using Aspose.PSD.ImageLoadOptions;
using Aspose.PSD.ImageOptions;
namespace TestPSD
{
public class PsdToPdf
{
public static void ConvertPsdToPdf()
{
String path = @"/Users/Documents/KnowledgeBase/TestData/";
// Applying product license to convert PSD to PDF in C#
License PsdToPdfLic = new License();
PsdToPdfLic.SetLicense(path + "Conholdate.Total.Product.Family.lic");
using (var psdImage = (PsdImage)Image.Load(path + "AllAdjustments.psd", new PsdLoadOptions()))
{
psdImage.Save(path + "PsdConverted_To_Pdf.pdf",
new PdfOptions()
{
PdfDocumentInfo = new PdfDocumentInfo()
{
Author = "Aspose.PSD for .NET",
Keywords = "Convert, Psd, Pdf, HowTo",
Subject = "Convert PSD to PDF",
Title = "Pdf From Psd",
},
ResolutionSettings = new ResolutionSetting(5, 6)
});
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment