iTextSharp convering database HTML content to an open document - html

I have a process that converts "text" content to PDF. All "text" is stored in a database.
We have recently added HTML content to the UI and database. So, I need to modify the pdf generation process to, "on the fly," convert HTML to PDF. I would like to use the XMLParser, but all of the examples show opening a new document - the process I need is to convert HTML to a PDF paragraph to push into an open document. Any ideas would be appreciated.

Related

SSRS create PDF or Excel from <form> POST

According to this Microsoft dev guidance, it should be possible to have a element on a web page do a POST via the method=POST attribute of the form. It shows an example of HTML needed in order to open a report viewer to a report and render the HTML viewer. I have that working. I would like to use the exact same technique to create a PDF or Excel file, but it doesn't work when I update the Format parameter to either PDF or EXCELOPENXML. Instead it ignores that parameter and provides the HTML viewer anyway. I would like to stick to one technique for both opening the HTML viewer and for downloading the various file formats. Does anyone know a workaround? I have considered a generic function to take the hidden elements and tack them on to the action URL, and open a new window with that. Does anyone have the code to do that?
I would still be curious to know if there's an issue with the POST action for file exports, but in the meantime, I solved it with this:
$("form").find(":input[name]").map(function(val, key) {
return encodeURIComponent($(this).attr('name'))
+ '='
+ encodeURIComponent($(this).val()).replace(/%2C/g,',').replace(/%20/g,' ');
//unencode space and comma characters for convinience and shorter URLs
}).get().join("&")

UiPath integration with Linkedin - Html characters not preserving formatting

We have an RPA on a site, to post a form. In the form we want to send HTML content with formatting. But the site is removing all the formatting, and is just showing html characters as is (like a text). But when we are copy pasting the content from tinymce editor (at our end) to the same site's form it is showing the content properly with formatting.
What needs to be done from my end while sending data to UiPath so that it puts the content in proper html format with formatting preserved?
I also tried sending html codes encoded by gson which is done by default. That also did not work.
This is when we are copy pasting the content -
And this is when we are sending data via uipath -
EDIT
This is what the uipath activity looks like (The description is being sent by an http api which uipath calls to get data) -
Thanks
Better use the Assign activity:
In the String variable website you simply save the HTML page. Now you can easily paste the variable anywhere. Also you don't need to paste the HTML in your editor via CTRL+V.
Just use the Type into activity:

Php script to loop list of urls and save as PDFs?

I was wondering if it was possible and what exactly I would need to loop through a list of url links and save those pages as pdfs. I would like to create a script that could do this but not sure how realistic it is.
Example:
www.site1.com
- save pdf locally site1.pdf
www.site2.com
- save pdf locally site2.pdf
It is realistic, although it needs a bit coding, as saving HTML pages as PDF files is not that simple.
There are libraries like FPDF or mPDF for PHP that can convert a HTML doc into a valid pdf, but it will not take a 'screenshot' of the page, but rather build it from the HTML tags and the CSS. They even allow changing the CSS file to your custom one.
(If you want to take a screenshot there is always PHP's imagegrabscreen(), but it will only work on a Windows server.)
You will just have to fetch the dom from your url:
$html = file_get_contents('http://site1.com');
Convert it to a pdf with one of the mentioned libraries, and save it as a file:
$mpdf = new mPDF();
$mpdf->WriteHTML($html);
$mpdf->Output();
See:
http://fpdf.org
http://mpdf1.com
(I personally prefer mPDF - it is based on FPDF and has a nice and easy API.)

Solution to generate MS Word document dynamically taking the contents from an HTML file

Looking for a solution where I can generate a MS Word document dynamically with the machine readable data (HTML).
MS Word Template document + HTML file = Output Word document.
E.g.:
Content of Word document = I'm the < > document.
Content of HTML file = <td> example </td>
Output Word document = I'm the example document.
What could be the good methodology or tool to start with?
Open XML SDK using the "altChunk" method to "embed" the HTML file into the WordOpenXML Document "package" at the required "target" point. Word will convert and integrate the HTML into the document when it's opened in Word. See, for example:
http://blogs.msdn.com/b/ericwhite/archive/2008/10/27/how-to-use-altchunk-for-document-assembly.aspx

How can I import html content to pdf template?

I created a pdf template with open office draw. it has textboxes and I can set values with acrofield. But I can't import a html content to template.
I can convert html contents to pdf file; but for template, how can I do it?
My problem is with template; also my html content have to map on page, for example center of page.
Thanks
I am not quite sure if I understand your question, but it seems like you need some kind of template where you will enter your content.
My thinking goes to OpenXML as the best fit. But since it is rather complex you can save some time by using third party tools.
From my experience, Docentric gives you good value for the money. You can prepare a template in Word and then merge it with data from any source that can fit into .NET object. Your document can be converted to pdf or xps if required.
Templates are generated in MS Word (2007 or newer) using special Docentric Add-in for template generation. All MS Word formatting can be applied here. Placeholders for data are set where the data will appear at runtime.
The process is straight forward so even end users can design reports. Developers then focus on bringing data in from various sources (database, XML). Chech the product documentation for ideas how to use it.