Posted By

nausherwan on 05/20/14


Tagged

pdf AsposePdf Aspose


Versions (?)

Create PDF file in ColdFusion using Aspose.Pdf for Java


 / Published in: Java
 

Following code snippet shows how the developers can use Aspose.Pdf for Java in ColdFusion to create a PDF file.

  1. <html>
  2. <head>
  3. <title>Hello World</title>
  4. </head>
  5. <body>
  6. <!--- Create License Object and set License --->
  7.  
  8. <cfset lic = CreateObject("java", "com.aspose.pdf.License")>
  9.  
  10. <cfset lic.setLicense("Aspose.Total.Java.lic")>
  11.  
  12. <!--- Create PDF object and add a section in PDF --->
  13.  
  14. <cfset demo_pdf = CreateObject("java", "aspose.pdf.Pdf").init() >
  15. <cfset section = CreateObject("java", "aspose.pdf.Section").init() >
  16. <cfset sec1 = demo_pdf.getSections().add() >
  17.  
  18. <!--- Create Text Object and add Hello World Text --->
  19.  
  20. <cfset text = CreateObject("java", "aspose.pdf.Text").init("Hello World") >
  21. <cfset sec1.getParagraphs().add(text)>
  22.  
  23. <!--- Save the newly create PDF file to disk --->
  24.  
  25. <cfset demo_pdf.save("HelloWorld.pdf")>
  26. </body>
  27. </html>

Report this snippet  

You need to login to post a comment.