Using razor view engine for multilingual support html5 app - html

my keys and values for translating the web app (AngularJS) are located in DB
Is there a way for razor to get a request for sample_{culture}.html and manipulate the html containing translation keys to return a translated html?

If you get your translation strings from the db instead of a resx file, you have to write your own resource provider:
http://msdn.microsoft.com/en-us/library/aa905797.aspx
This is not complicated and there are examples out there for a DB resource provider.
Once you have that, you can just localized the razer cshtml files. I don't think this works with normal html files though.

Related

Generating .html file from template engine

My aim is to create some html files (about 30, preferably via CLI) that are identical except for some arbitrary variables to be replaced in the url of links and scripts sources.
I wish I could automate the file creation process but I'm still struggling with the structure.
My first idea was to use Mustache or Handlebars and save the HTML output to file. It's possible with those tools? Are there any more suitable tools or methods?
Ideal for me would be to create files via node and CLI
Any suggestions are welcome.

How can I interact with html file in delphi intraweb?

Hi I am currently working on delphi intraweb. I try to import html template file to the program instead of hard-code it by using components from tool palette. However, I cannot find anyway to interact with the html file satisfyingly. For example, I want to handle the values of input box in the html file or adding data to data table through delphi. Or should I perform the tasks through other aspects?
I am using IWTemplateProcessorHTML to load external html template to delphi but I couldnt figure out a way to pass values from the html file to delphi or from delphi to that html file in run-time. There is not coding involved yet.
Thanks.

word doc from sql server 2008 to jsp

How best i can store a word doc in sql server 2008 and retrieving in HTML format to show it in a JSP FILE
the html file should not loose the Rich text format and images.
Regards
prasad
Although not quite raw HTML output, this can be done using the Google Docs viewer in an embedded iframe and can be accomplished in two steps. You will need to first create a Servlet or JAX-RS which will provide the document as a resource. There are many examples on how to do this, but you might want to start here. Then you can write your JSP with a simple iframe using the Google Doc's viewer URI which references your resource URI:
<iframe src=""http://docs.google.com/gview?embedded=true&url=http://your.document/resource"></iframe>
The end result is quite useful as it contains many standard Google Docs features. Here is also a sample of what the iframe will display.

how can i read properties file in jsp using html5

Can anyone give the solution for reading .properties file from jsp page (using HTML5 or other tags)?
A JSP is a servlet with a different syntax. It executes at server-side. HTML5 is a markup language interpreted by browsers, at-client-side. It has nothing to do with reading properties files.
Since JSPs are servlets, they can contain any kind of Java code. So you read a properties file in a JSP the same way you would do it in any Java application (using the java.util.Properties class).
However, in well-designed applications, the JSP is only used as a view, generating markup from data prepared by a controller written in Java. It's the job of the controller to read a properties file. Not the job of a JSP.
I think you should read tutorials and understand what a servlet, a JSP, an HTML page, and MVC are, because you seem quite confused.

How to extract data from a PDF?

My company receives data from an external company via Excel. We export this into SQL Server to run reports on the data. They are now changing to PDF format, is there a way to reliably port the data from the PDF and insert it into our SQL Server 2008 database?
Would this require writing an app or is there an automated way of doing this?
As already mentioned - you will have to write an app to do this, but ideally you would be able to get the raw data from the external company rather than having to process the PDF.
However, if you do want to extract the data from the PDF, I've used iText and found it to be very powerful, reliable and most importantly - free. It comes in Java and .Net flavours - iTextSharp is the .Net version. It allows you to programatically manipulate PDF documents and it will expose the contents of the PDF to the application that you write.
It all depends on how they've included the data within the PDF. Generally speaking, there's two possible scenarios here:
The data is just a text object within a PDF. You'll need to use a tool to extract the text from the PDF then insert it into your database.
The data is contained within form fields in a PDF. You'll need to use a tool to extract data from the form fields and insert it into your database.
Hopefully scenario #2 applies to you because this is precisely what PDF forms are designed for. Scenario #1 is really just a hack that you'd only use if you didn't have any other options. Extracting plain text from a PDF isn't as easy or accurate as you might expect.
If you're receiving a PDF form then all you need to do is match up the right fields in the PDF form with the corresponding fields in your database and then suck in the data. This process could be entirely automated if you wrote your own application.
Would this require writing an app or
is there an automated way of doing
this?
Yes, both of these options would require writing an app or buying an app. If you write your own app then you'll need to find a third-party PDF library that supports retrieving data from form fields or extracting text from a PDF.
Disclaimer: I am affiliated with the makers of ByteScout PDF Extractor SDK tool
Just wanted to share some additional real-life scenarios for text data extraction from PDF:
Scanned image with no searchable text: should be processed by OCR engine (like free Tesseract from Google)
XFA forms: it is the subset of PDF which is supported mostly by Adobe tools. But the data can be extracted as XML data with low level PDF processing tools like iTextSharp or similar tools.
ZUGFeRD PDF files which are just PDF documents with the copy of a form data attached as XML file (which can be extracted with tools like this)
Text incorrectly encoded by some PDF generators (can be restored via OCR engine with some acceptable error rate though).
Using ItextSharp, do the following
using System;
using System.Configuration;
using System.Data.SqlClient;
using System.IO;
using System.Text;
using iTextSharp.text.pdf;
protected void BtnSubmit_Click(object sender, EventArgs e)
{
String FilePath = #"GetFilePath";
StringBuilder sb = new StringBuilder();
PdfReader reader = new PdfReader(FilePath);
PdfStamper myStamp = new PdfStamper(reader, new FileStream(FilePath + "_TMP", FileMode.Create));
AcroFields form = myStamp.AcroFields;
if (form.GetField("GetFieldIdFromPDF") != null)
sb.Append(form.GetField("GetFieldIdFromPDF").ToString());
}
I think you will have to write an application for this. This question talks about extracting data from PDF. After this you can export the data to excel format so that you can preserve the existing import format.
Look for information on "Scraping" the data from the PDF. I believe Adobe has some tools that allow you to do this for simple text but I've not used them.
Honestly though, I would try to do anything you can to get this data in a raw format from your vendor.