How to create WinForms PDF document in Azure function? | Syncfusion (2024)

The Syncfusion Essential PDF is a feature-rich and high performance .NET PDF Libraryused to create, read, and edit PDF documents programmatically without Adobe dependencies. Using this library, you can create PDF document using .NET in Azure functions.

Steps to create PDF in Azure functions programmatically:

  1. Create a new Azure function project. How to create WinForms PDF document in Azure function? | Syncfusion (1)
  2. Select framework Azure Functions v1 (.NET Framework) and HTTP trigger as follows. How to create WinForms PDF document in Azure function? | Syncfusion (2)
  3. Install the Syncfusion.Pdf.WinForms NuGet package as a reference to your Azure functions project from NuGet.org. How to create WinForms PDF document in Azure function? | Syncfusion (3)
  4. Include the following namespaces in Function1.cs file.

C#

using Syncfusion.Pdf;using Syncfusion.Pdf.Parsing;using Syncfusion.Pdf.Graphics; using Syncfusion.Pdf.Grid;
  1. Add the following code snippet in Function1 class to create PDF document in Azure functions.

C#

//Create a new PDF document.PdfDocument document = new PdfDocument();//Add a page to the document.PdfPage page = document.Pages.Add();//Create PDF graphics for the page.PdfGraphics graphics = page.Graphics; //Set the standard font. PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);//Draw the text.graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));MemoryStream ms = new MemoryStream();//Save the PDF document document.Save(ms);ms.Position = 0;HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);response.Content = new ByteArrayContent(ms.ToArray());response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment"){ FileName = "PDFDocument.pdf"};response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/pdf");return response;
  1. Right-click the project and select Publish. Then, create a new profile in the Publish Window.How to create WinForms PDF document in Azure function? | Syncfusion (4)
  2. Create App service using Azure subscription.How to create WinForms PDF document in Azure function? | Syncfusion (5)
  1. After creating the profile, click the publish button. How to create WinForms PDF document in Azure function? | Syncfusion (6)
  2. Now, go to Azure portal and select the Functions Apps. After running the service, click Get function URL > Copy. Paste the same in the new browser tab. You will get the output PDF document as follows. How to create WinForms PDF document in Azure function? | Syncfusion (7)

A Complete working sample can be downloaded from PDFCreation_AzureFunction.zip.

Take a moment to peruse the documentation, where you will find other options like drawing right-to-left text and multi-column text, consuming TrueType fonts, Standards fonts, and CJK fonts. Also, the features like PDF form filling, extract text or images from PDF, and protect PDF documents with code examples.

Refer here to explore the rich set of Syncfusion Essential PDF features.

An online sample link to generate Hello world PDF document.

See Also:

Create a PDF file in Xamarin

Create a PDF file in ASP.NET Core

Create a PDF file in ASP.NET MVC

Create a PDF file in Windows Forms

Note:

Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.

Conclusion

I hope you enjoyedlearning on how tocreateWinForms PDF document in Azure function.

You canrefer to ourWinForms PDFfeature tourpage toknow about its othergroundbreaking feature representationsanddocumentation,andhow toquickly get started for configuration specifications. You can alsoexploreourWinForms PDF exampletounderstand how to create and manipulate data.

For current customers,you can check outourcomponentsfrom theLicense andDownloadspage.If you are new to Syncfusion, you can tryour 30-dayfree trialtocheck out our other controls.

If you haveany queries or require clarifications, please let us know in the commentssection below.You can also contact us through oursupport forums,Direct-Trac,orfeedback portal.We are always happy to assist you!

How to create WinForms PDF document in Azure function? | Syncfusion (2024)
Top Articles
Latest Posts
Article information

Author: Rueben Jacobs

Last Updated:

Views: 6272

Rating: 4.7 / 5 (77 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Rueben Jacobs

Birthday: 1999-03-14

Address: 951 Caterina Walk, Schambergerside, CA 67667-0896

Phone: +6881806848632

Job: Internal Education Planner

Hobby: Candle making, Cabaret, Poi, Gambling, Rock climbing, Wood carving, Computer programming

Introduction: My name is Rueben Jacobs, I am a cooperative, beautiful, kind, comfortable, glamorous, open, magnificent person who loves writing and wants to share my knowledge and understanding with you.