Matching DOC and PDF content to string in PHP - php

So my client want to add a feature to their job site whereby a user uploads a PDF or DOC CV/Resume file to a particular job that they are applying for. The system will then create a score whereby it evaluates how appropriate the candidate is for the job that they're applying for. So in the job description, if it says "2 years banking experience", and in the CV/Resume file it says "Barclays Bank - 2 Years", then it adds more to this score for them.
I have advised the client that I do not think that this is the best way to go about things. I feel it would be much better if the job applicant created a profile on the website where they enter this data into the website themselves (similar to LinkedIn) as all data will be appropriately stored.
They are set on the first option and I'm just wondering what the best way of going about this would be? My first thoughts would be to extract the text contents from the document.

What you want cannot be made fully functional, even though data extraction from DOC and PDF files is possible
Although, you can tell you client that the visitor, candidate, can download a Sample CV, fill it, paste it and then upload it; to get particular ratings

Related

Server-side dynamic Flash export to video

I have spend some time hunting around for a solution without success so I am hoping someone here can at least point me in the right direction.
The specific project flow is this:
user visits a Facebook app
user uploads a number of photos and chooses optional filters
user can preview a video which showcases their photos (the video has animation and audio)
user can then choose to download this video for their device/PC
Some givens:
server side is PHP on Linux/Apache
preview video is Flash
output format is variable (WMV/AVI/MP4)
I have found a couple of solutions but none seem to match this exact flow. I want the whole process to be automated/scripted so need a component that can sit on the server, accept commands from PHP and be able to handle dynamic Flash input and export to the chosen format. My client has a generous budget to buy software to do this.
If anyone can suggest a good software solution or indeed another method to achieve the same goal I would be eternally grateful...
Thank you!
I won't give the exact details of how to do this yet, but a brief outline of what you could do:
User uploads video (or it's already on the server? I'm not sure)
You use exec() or shell_exec() to run ffmpeg, which will convert the
flash file to another output, depending on the user's choice.
What I would recommend is writing a bash script or something that takes a command line parameter of the output choice (and input file of course), converts the file, and returns the location of the new file. You can use the output of exec() or shell_exec() in PHP to return the location to the user and allow them to download the file.
If you would like more details on a certain aspect, please comment, but I'm not sure if you've already looked into this method, so for now it's just a suggestion.

fill in PDF form using data in MySQL database

I am working on an online time card system to replace the paper time cards. What I have done is create a webpage in PHP that takes the time in and out along with job description and other values the user inputs and stores them in a MySQL database. Everything is working just fine.
What I would like to work on next is to take the information from the database for the specific user and week and have it fill in a PDF template file I have created from scanning the old paper time card and making it into a PDF form. I dont know if this is possible I have been researching it online and all I can come up with is how to generate a new PDF file. I am hoping someone here can point me to a source of information on how to do this.
Here is an example of exactly what I want to do http://try.fillpdf-service.com/
Hi congratulation for you about done the 1st step in time,
You can use very complete pdf generator php class TCPDF
It started in 2002, TCPDF is now one of the world's most active Open Source projects, used daily by millions of users and included in thousands of CMS and Web applications.
http://www.tcpdf.org/ for genarating your pdf what kind your want this class has very useful documnet and simple to use
Cheers,
Farzam
Take a look ath this
http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
It can be invoked as a command line tool and among the other functions let fill form fields, (on an already existing PDF you supply).
Maybe FPDF is quite old, but still good to handle for PDF generation. Just take a Template PDF (create as you like) and put the informations you want on it. You will have to place your data on the specific positions, see the tutorial section for a better understanding.
Another popular solution is to use Zend_PDF from well known Zend Framework, but I think FPDF would be a tick easier to work with if you are not very experienced.

Getting data from a Barcode Scanner using PHP

I've read a couple of posts here on the site and as far as I understand it, using PHP to get and process the information obtained through a Barcode Scanner is possible, however I'd like to ask just to make sure, is it recommended? are there any caveats I should be aware of?
EDIT
I don't know the software of the barcode scanner since I haven't had access to it, however I described how it works on the comments down here. the barcode generates a fixed number of characters so I guess I could use a javascript event listener =)
I've noticed a lot of stores use online or LAN POS sites to handle purchases. Typically, the add an item page will set focus to a text field devoted to the product's barcode. When the scanner scans the barcode it's been preconfigured to output the code to wherever the cursor is (in this case, the barcode text field). Most system then have a JavaScript event listener on the field that submits the new item when a barcode is entered (the field reaches a certain length). Of course this is all theory. If you want sample code, please provide more specifics on the scanner and the software it came with.

How do you make a social network badge?

You see them everywhere. Like the twitter and facebook buttons that show up on blogs and websites that display a number of "tweets" or "likes".
All I need to be able to do is display a number from my MySQL database based on two variables (username and an ID). It would probably be useful to encrypt the variables somehow so that users can't just alter the badge's code and display another user's number.
But more importantly, I just need to know how to use the HTML code like you find in social network badges and have it talk to a PHP script on my server which will calculate the number from the database based on the variables held within the badge.
Any clue where to start?
Edit: I'm not talking about the kind of badges like you find on stackoverflow, I mean the kind other sites let you paste on your blog/site. Like Digg lets you show that your site has been dugg 7000 times, etc.
You may wish to look up the GD library for PHP and related tutorials. Basically, all those badges consist of is a static image as the template with some dynamic text inserted on top, usually consisting of the username and a number (likes, tweets, etc..).
For the HTML code, you would do something similar to:
<img src="http://www.yourserver.com/yourscript.php?username=miki&id=1337" />
This will send a HTTP GET request to your script, causing it to execute. Your script can then communicate with the database, fetch the user's information, use GD to insert that text into a template and then return that to the browser with the correct mime type and content.
You're talking about calling a remote script, essentially.
I assume you mean something like this -
You are viewing your profile on your side. You have a widget that promises to display the total number of points you have, for example.
You offer a "code" button like youtube embed or facebook "like"
The user clicks this, gets a segment of code and is expected to be able to paste it anywhere on the internet where applicable and the code will generate an icon or something with presumably the username and their points.
First, you can do this several ways. The most cost effective, in my opinion, is to generate the user button on your server on update - like say your points meant "number of thumbs up your articles received" so it will be an integer value. Every time you get a thumbs up, you would re-cache the button and write it into a flat text file. If you're good, you would write it to an image and flatten it to a jpg or gif. If you don't know how to do that, you can write it to html and save the file as a user specific "slug" like md5(username).'.html' - that way every time the server is called, you don't need to pile on bandwidth with redundant queries and account look ups. You only serve the optimized image or html file.
Second - you can give the user an iframe that has the html in it. This is generally how facebook "like" does it for people that don't use the fbml method. Problem is, many sites see iframes as potential xss attack and will strip them out. So, in order to make use of the iframe you would need to have control of the domain, which may defeat the purpose of your request if the intention is to share your profile goodies.
Third, you can call a js file on your server that makes an ajax call to your database and serves the results. This is also most likely going to be seen as xss attack and you should probably not even give it much more thought.
I mentioned the iframe and js methods in case you were looking to provide an option for other people who run their own sites. The way "like" is used by site owners to show how many times their domain has been "liked" and so on. These people have control of domains so the iframe and js methods are logical.
So -
This answer may not have much in way of raw code for you, but it should help you start.
I would do the image method since it is safer. You would give the user an image tag with their slug in the src attribute. They can paste it anywhere and there is no way to re-write the number within the image. Most forums and places where you can just post to other people's sites allow images. Just do a google search on drawing images with php, as well as using the imagemagick library to merge text and images.

Suggestions for making an offline version of an online form?

I work for a school district in which the teachers submit their lesson plans to their principals online.
They do this using an online form I wrote using PHP/MySQL and it uses TinyMCE for its textareas. One of the major features that was requested was for teachers to be able to save their incomplete forms as drafts to submit later. This was implemented, but the new problem I'm facing is that not all teachers have access to the internet at home, thus they cannot work on their lesson plans while at home.
Of course, they could cut and paste out of a word document or text file that they save on their laptops, but then they have to cut/paste one textarea at a time, and they complain about it.
So what I was thinking about trying, is making an offline application that looks like the online form, but saves the form in an xml format on their computer. Then they could open this file to keep working on it, or upload it to the online form later.
My question is: being that my programming experience is currently limited to a few web-related languages (php, javascript, html) what should I use to attempt to write this offline app? Winbinder? Adobe AIR?
I think your best bet will be to ask them to install Google Gears on their browser (comes by default with Google Toolbar iirc), which is ideal for storing content offline. And then as soon as they go online it's easy to sync the stored content back to your online server.
Gears API Documentation can be found here.
How are teachers currently working on their lesson plans offline?
If they're doing it in plain text, for example, perhaps you can simply add a file upload field. They would upload their file (which they worked on offline), and your web app would parse it and divide it up into the appropriate sections.
(If rich text is a requirement, they can use a Word doc.)
To aid with parsing, you could tell them to use section headers -- maybe special words in all caps -- or provide them an example template (which maps directly to the web form) to start from.
The idea here is that you may want to minimize the changes teachers will need to make. They're already used to what they're currently doing, so work with their current habits. It would be easier than having them change and do something new. Installing a new offline app on their computers is almost certainly a significant barrier.
(While I was typing this answer, Josh Curren submitted a similar one.)
I would save the form to a text file that they can save to their desktop, then upload it and read it into the form later. You would have to supply them with a template so that everything they enter is in the correct order.
One simple option would be to build a regular desktop app they could install locally and take with them. Have an upload function in the app that allows them to submit it when they are connected to the internet.
Another option is to use create an editable PDF of the form, then either a) submit those as a whole to the principal, or b) parse out the field data on the server side.
IF they are using Internet Explorer at BOTH school and home, you could give them the form in a webpage saved in the web archive format, *.mht. They fill out the form at home and save it in the same *.mht format. When they return to school they open the page and submit it.
This should work and may be simple to implement. I tried it on this post, but ran into problems somewhere between the captcha and the openid login. Give it a try on your form.
I've actually gone with Adobe AIR to do this.
With AIR, the form looks nearly identical to the one that's used online and even uses the same TinyMCE library. And I didn't have to learn much to get it going, just the AIR javascript API.
I'm also using AIR to write a few other apps and I love it.

Categories