Sha256: 5ba993b7fe88ab1b782bceeef562ebc634fcfe90546afcc7d63bc805fd4c0e38
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
module Asposepdfjava module AddHtml def initialize() # The path to the documents directory. data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/' # Instantiate Document object doc = Rjb::import('com.aspose.pdf.Document').new # Add a page to pages collection of PDF file page = doc.getPages().add() # Instantiate HtmlFragment with HTML contents title = Rjb::import('com.aspose.pdf.HtmlFragment').new("<fontsize=10><b><i>Table</i></b></fontsize>") # set MarginInfo for margin details margin = Rjb::import('com.aspose.pdf.MarginInfo').new margin.setBottom(10) margin.setTop(200) # Set margin information title.setMargin(margin) # Add HTML Fragment to paragraphs collection of page page.getParagraphs().add(title) # Save PDF file doc.save(data_dir + "html.output.pdf") puts "HTML added successfully" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
asposepdfjava-0.0.2 | lib/asposepdfjava/Text/addhtml.rb |
asposepdfjava-0.0.1 | lib/asposepdfjava/Text/addhtml.rb |