Posted by a ceTe Software moderator
Hello Suli,
Yes, you can output the PDF in the form of a byte array by adding the image which is in the form of a byte array using DynamicPDF Generator for .NET product. You will need to use the ImageData class to load the image byte array and then add it to the PDF using Image page element. Please refer to the documentation on Image page element
here. Then draw the PDF using draw method. You can refer to the documentation on document output
here. Also below is the code sample for it.
Document document = new Document();
Page page = new Page();
byte[] imagebyteData = File.ReadAllBytes(@"C:\temp\Images\Winter.jpg");
ImageData imageDataObj = ImageData.GetImage(imagebyteData);
Image image = new Image(imageDataObj, 0, 0, 1);
page.Elements.Add(image);
document.Pages.Add(page);
//drawing the PDF into byte array.
byte[] pdfbyteData= document.Draw();
It is not possible to convert the Word document to PDF using DynamicPDF Generator API but we have another product called DynamicPDF Converter for .NET using which you can convert Word document to PDF. Please refer to the documentation on supported file types and software requirements
here and also documentation on operating system requirements
here. Below is the code sample to convert the word document to PDF byte array.
byte[] wordDocByteData = File.ReadAllBytes(@"D:\temporary\ConverterIssues\Document1.docx");
byte[] pdfByteData = Converter.Convert(wordDocByteData, "Document1.docx");
You can download evaluation edition of DynamicPDF Converter for .NET product from our website
here. Also refer to the code samples included with the evaluation download.
Thanks,
ceTe Software Support Team.