{"id":3774,"date":"2015-09-20T03:11:21","date_gmt":"2015-09-20T08:11:21","guid":{"rendered":"http:\/\/www.filecloud.com\/blog\/?page_id=3774"},"modified":"2025-04-16T08:24:07","modified_gmt":"2025-04-16T13:24:07","slug":"generate-pdf-from-net","status":"publish","type":"page","link":"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/","title":{"rendered":"Generate PDF from .NET"},"content":{"rendered":"<p>Generating PDF from .NET has always been a cumbersome task. There are a couple of different ways by which a PDF can be created from Microsoft.NET.\n<\/p>\n<ol>\n<li><a href=\"http:\/\/msdn.microsoft.com\/en-us\/magazine\/cc301570.aspx\" target=\"_blank\" rel=\"noopener\">Crystal Reports.NET<\/a> that comes with the Visual Studio.NET<\/li>\n<li>Free Utilities like NFop and Open source systems Report.NET, PDFSharp etc.<\/li>\n<li>Commercial software such as <a href=\"http:\/\/www.websupergoo.com\/\" target=\"_blank\" rel=\"noopener\">ABC Pdf<\/a>, Aspose Pdf, etc<\/li>\n<\/ol>\n<p>NFOP has always been my favorite to generate PDF documents. I have used this in enterprise level web applications to generate hundreds of PDF documents successfully. NFOP was originally developed by <a href=\"http:\/\/nfop.sourceforge.net\/\" target=\"_blank\" rel=\"noopener\" class=\"broken_link\">Jason Pettys<\/a>. It is an extension of the open source project <a href=\"http:\/\/xmlgraphics.apache.org\/fop\/\" target=\"_blank\" rel=\"noopener\">Apache FOP<\/a>. NFOP (Formatting Objects Processor) accepts XSL-FO (XSL-Formatting object) as input and renders the result in PDF as output.<\/p>\n<p>Even though the <a href=\"http:\/\/nfop.sourceforge.net\/article.html\" target=\"_blank\" rel=\"noopener\" class=\"broken_link\">original article on NFOP<\/a> by Laurent Kempfe gets you started, in the initial days I found this not adequate as it fails to provide a comprehensive view of how the FOP, .NET, XML, and XSL-FO go together in creating a PDF. This blog aims to bridge that gap.<\/p>\n<p><strong>Follow these six steps to successfully generate a PDF on the fly.<\/strong><\/p>\n<ol>\n<li>Download <a href=\"http:\/\/sourceforge.net\/projects\/nfop\/\" target=\"_blank\" rel=\"noopener\" class=\"broken_link\">NFop<\/a>.<\/li>\n<li>Download Microsoft J#.NET redistributable package for<a href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?FamilyId=E3CF70A9-84CA-4FEA-9E7D-7D674D2C7CA1&amp;displaylang=en\" target=\"_blank\" rel=\"noopener\"> .NET 1.1<\/a> or for <a href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?familyid=F72C74B3-ED0E-4AF8-AE63-2F0E42501BE1&amp;displaylang=en\" target=\"_blank\" rel=\"noopener\">.NET 2.0<\/a><\/li>\n<li>Create an ASP.NET project and add ApacheFop.Net and vjslib as a reference to the project.<\/li>\n<li>Data in XML format: Usually when generating a PDF document you will be dealing with dynamic content rather than static content. The first step is to get all the data that you want in a properly formatted XML document.<br \/>\n&lt;?xml version=\u201d1.0\u2033 encoding=\u201dutf-8\u2033?&gt;<br \/>\n&lt;product&gt;<br \/>\n&lt;name&gt;Tonido&lt;\/name&gt;<br \/>\n&lt;developedby&gt;Codelathe&lt;\/developedby&gt;<br \/>\n&lt;website&gt;http:\/\/www.tonido.com&lt;\/website&gt;<br \/>\n&lt;\/product&gt;<\/li>\n<li>Create XSLT: Google XSL-FO and you will find lot of articles on the subject. However, you have to remember that not all the language elements in XSL-FO are supported by NFOP and there are no reliable documents that I have come across that provide this information. When generating complex PDF docs you may end up following trial and error method to find the XSL-FO elements accepted by NFOP. However, for most practical purposes you should not have any problem.<\/li>\n<li>Render PDF: Use the C# Code, XML (as part of C# code) and XSLT-File to generate the PDF. That\u2019s all to it.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Generating PDF from .NET has always been a cumbersome task. There are a couple of different ways by which a PDF can be created from Microsoft.NET. Crystal Reports.NET that comes with the Visual Studio.NET Free Utilities like NFop and Open source systems Report.NET, PDFSharp etc. Commercial software such as ABC Pdf, Aspose Pdf, etc NFOP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.13 (Yoast SEO v20.13) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Generate PDF from .NET<\/title>\n<meta name=\"description\" content=\"Generating PDF from .NET has always been cumbersome. Here are a couple of different ways to create PDF files from Microsoft.NET.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Generate PDF from .NET\" \/>\n<meta property=\"og:description\" content=\"Generating PDF from .NET has always been cumbersome. Here are a couple of different ways to create PDF files from Microsoft.NET.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/\" \/>\n<meta property=\"og:site_name\" content=\"FileCloud blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/tonidopage\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-16T13:24:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.filecloud.com\/blog\/wp-content\/uploads\/2023\/05\/FC-OG-image.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"551\" \/>\n\t<meta property=\"og:image:height\" content=\"289\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@getfilecloud\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/\",\"url\":\"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/\",\"name\":\"Generate PDF from .NET\",\"isPartOf\":{\"@id\":\"https:\/\/www.filecloud.com\/blog\/#website\"},\"datePublished\":\"2015-09-20T08:11:21+00:00\",\"dateModified\":\"2025-04-16T13:24:07+00:00\",\"description\":\"Generating PDF from .NET has always been cumbersome. Here are a couple of different ways to create PDF files from Microsoft.NET.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.filecloud.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Generate PDF from .NET\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.filecloud.com\/blog\/#website\",\"url\":\"https:\/\/www.filecloud.com\/blog\/\",\"name\":\"FileCloud blog\",\"description\":\"Topics on Private cloud, On-Premises, Self-Hosted, Enterprise File Sync and Sharing\",\"publisher\":{\"@id\":\"https:\/\/www.filecloud.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.filecloud.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.filecloud.com\/blog\/#organization\",\"name\":\"FileCloud\",\"url\":\"https:\/\/www.filecloud.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.filecloud.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.filecloud.com\/blog\/wp-content\/uploads\/2016\/02\/filecloud_logo_comparison.jpg\",\"contentUrl\":\"https:\/\/www.filecloud.com\/blog\/wp-content\/uploads\/2016\/02\/filecloud_logo_comparison.jpg\",\"width\":155,\"height\":40,\"caption\":\"FileCloud\"},\"image\":{\"@id\":\"https:\/\/www.filecloud.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/tonidopage\",\"https:\/\/twitter.com\/getfilecloud\",\"https:\/\/www.linkedin.com\/company\/codelathe\",\"https:\/\/www.pinterest.com\/filecloud\/filecloud\/\",\"https:\/\/www.youtube.com\/channel\/UCbU5gTFdNCPESA5aGipFW6g\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Generate PDF from .NET","description":"Generating PDF from .NET has always been cumbersome. Here are a couple of different ways to create PDF files from Microsoft.NET.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/","og_locale":"en_US","og_type":"article","og_title":"Generate PDF from .NET","og_description":"Generating PDF from .NET has always been cumbersome. Here are a couple of different ways to create PDF files from Microsoft.NET.","og_url":"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/","og_site_name":"FileCloud blog","article_publisher":"https:\/\/www.facebook.com\/tonidopage","article_modified_time":"2025-04-16T13:24:07+00:00","og_image":[{"width":551,"height":289,"url":"https:\/\/www.filecloud.com\/blog\/wp-content\/uploads\/2023\/05\/FC-OG-image.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_site":"@getfilecloud","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/","url":"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/","name":"Generate PDF from .NET","isPartOf":{"@id":"https:\/\/www.filecloud.com\/blog\/#website"},"datePublished":"2015-09-20T08:11:21+00:00","dateModified":"2025-04-16T13:24:07+00:00","description":"Generating PDF from .NET has always been cumbersome. Here are a couple of different ways to create PDF files from Microsoft.NET.","breadcrumb":{"@id":"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.filecloud.com\/blog\/generate-pdf-from-net\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.filecloud.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Generate PDF from .NET"}]},{"@type":"WebSite","@id":"https:\/\/www.filecloud.com\/blog\/#website","url":"https:\/\/www.filecloud.com\/blog\/","name":"FileCloud blog","description":"Topics on Private cloud, On-Premises, Self-Hosted, Enterprise File Sync and Sharing","publisher":{"@id":"https:\/\/www.filecloud.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.filecloud.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.filecloud.com\/blog\/#organization","name":"FileCloud","url":"https:\/\/www.filecloud.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.filecloud.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.filecloud.com\/blog\/wp-content\/uploads\/2016\/02\/filecloud_logo_comparison.jpg","contentUrl":"https:\/\/www.filecloud.com\/blog\/wp-content\/uploads\/2016\/02\/filecloud_logo_comparison.jpg","width":155,"height":40,"caption":"FileCloud"},"image":{"@id":"https:\/\/www.filecloud.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/tonidopage","https:\/\/twitter.com\/getfilecloud","https:\/\/www.linkedin.com\/company\/codelathe","https:\/\/www.pinterest.com\/filecloud\/filecloud\/","https:\/\/www.youtube.com\/channel\/UCbU5gTFdNCPESA5aGipFW6g"]}]}},"_links":{"self":[{"href":"https:\/\/www.filecloud.com\/blog\/wp-json\/wp\/v2\/pages\/3774"}],"collection":[{"href":"https:\/\/www.filecloud.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.filecloud.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.filecloud.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.filecloud.com\/blog\/wp-json\/wp\/v2\/comments?post=3774"}],"version-history":[{"count":12,"href":"https:\/\/www.filecloud.com\/blog\/wp-json\/wp\/v2\/pages\/3774\/revisions"}],"predecessor-version":[{"id":36399,"href":"https:\/\/www.filecloud.com\/blog\/wp-json\/wp\/v2\/pages\/3774\/revisions\/36399"}],"wp:attachment":[{"href":"https:\/\/www.filecloud.com\/blog\/wp-json\/wp\/v2\/media?parent=3774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}