Can we able to generate a pdf from HTML page , where we are using two css files Style.css and bootstrap.css. Is it is feasible to render html page to pdf as it is displayed in the UI.
Yes, we can generate a pdf from HTML page.You can generate your html page using phantom.js which provides a Javascript API to generate .pdf ,.png,.jpg etc of any static HTML page.Static page means single .html page where resources also included.The steps are as follow:
Download phantomjs-2.0.0-windows.zip from http://phantomjs.org/download.html.
Go to the C:\Users\USER\Downloads\phantomjs-2.0.0-windows\phantomjs-2.0.0-windows\bin ,{C:\ where library downloaded}
3.open a terminal and jump to C:\Users\USER\Downloads\phantomjs-2.0.0-windows\phantomjs-2.0.0-windows\bin>
type a command on terminal: phantomjs {refer rasterize.js} "your static html page url" {target dirctory/file.extension}
for example>C:\Users\USER\Downloads\phantomjs-2.0.0-windows\phantomjs-2.0.0-windows\bin> phantomjs ../examples/rasterize.js "http://phantomjs.org/download.html" abc.pdf
Related
I'm trying to scrape an Instagram page using SwiftSoup, but when I run let html = try String(contentsOf: URL("https://www.instagram.com/sasawpi/"), I get back a bunch of JS functions and CSS styles like this, probably because Instagram uses React and some package control to send files over from the server. My question is, can I render it as an HTML DOM, like a browser would, and get it as a text inside of SwiftUI using SwiftSoup or some other library. WebView renders web pages so one of my suggestions was to render it with WebView but I don't know how to get this HTML DOM as text from WebView either.
I'm using the html2pdf Native script plugin, and would like to define a header and a footer to apply to each page. What is the most expedient method I can use to specify headers/footers with html2pdf in each page rendered on pdf documnet?
Hi,
I have generated the HTML from PDF using conversion tool pdftohtmlEx, Then I am trying to convert this HTML to Pdf by using wkhtmltopdf
Problem i am facing is when HTML has more than one page, it is not generating same number of Pdf pages as like HTML i have.
Here is the result
Finally Resolved the issue, I have replaced following style generated by pdf2htmlEx
page-container{bottom:0;right:0;overflow:auto} with
.pf{margin:0;box-shadow:none;page-break-after:always;page-break-inside:avoid}
I am using fancybox in my rails applicaiton , I want to display server side pdf response in fancybox ,but I am not sure how to do this .
I did the like this
I am reading pdf file data and sending pdf response from server , on view I need to display this pdf response in fancybox how to do this .
or any alternate way that I can show a pdf in fancybox instead download pdf from the server when requesting server.
###my_controller.rb
def show
#pdf_data = File.open(doc.image).read.force_encoding('BINARY')
format.js {}
end
From the above line it states that I am reading pdf file data(doc.image refers location of the pdf file) , Now I need to display this pdf content in fancy box ,so I did like the following on the view side
## show.js.erb
$("#pdfview").html("<%= #pdf_data %>")
$("#inline").trigger('click')
I applied fancybox() for #inline which is id of anchor tag.
Can anyone help me how to do this or any alternate that I can make pdf from server pdf response within the fancybox in jquery or javascript?
I need to launch IE from my WP7 app and load the HTML to create the page dynamically. The HTML is read from a web service and can change at any time, so I'm not able to just store the HTML in a file. Is there a way to do this -- much like you do with WebBrowser.NavigateToString(strHtml)?
-Thanks!
If you are attempting to open your HTML content in an embedded WebBrowser control you can use the "NavigateToString" function and pass it the HTML content you would like to load.
If you are trying to open it in the native IE browser on the device then I would recommend putting state information in the URL and opening the page directly with any parameters required to replicate the view in the browser via the WebBrowserTask. This way you wouldn't technically be opening the HTML code from your app but you would be able to ensure that the HTML content loaded from your service is correct based on your query parameters.
Are you looking for WebBrowserTask?