Formatting text displayed when QR code is scanned - qr-code

Is there any way I can format the text displayed by scanning a QR code? I know how to make a QR code, and how to format the QR code itself so it can be different colours.
What I want to know is:
If the QR code decodes to the phrase "Hello World", is there any way I can make this phrase appear in blue/bold/15pt font?
Imagine the QR code decodes to "Here is a link for Google:" www.google.com. Here "www.google.com" is a working link. Is there a way I can hide the url (www.google.com) and instead display different text that links to www.google.com? Ex. Here is a link for Google: Click Here.
This will be very helpful for long urls.

No.
You can have plain ASCII or UTF-8 text. That's all the specification will allow.
You can use control character like %0A to create a newline. But that really is about the extent of it.
If you want colour, formatting, HTML links, etc - you're best off pointing the user directly to a web page.

Your second point is rather possible, which means most of the time it will work but it can also make the QR Code unusable (with some readers).
You can use this format: MEBKM. It is made for substituting a URL with a title.
But you'd better make your QR Code data as short as possible and use a mobile website instead as suggested.

Related

PDF OCR Google cloud vision keep spacing

I don't know if it's possible, but I'm receiving forms in PDF format. I need to take the text from the PDF in the exact same position it is in the file and place it in a text document I can parse like:
Line 4 startCharacter 50 endcharacter 60
This would give me whatever text is in that position.
Is this possible?
At the moment, it is not possible to do this. I found a Feature Request made to Cloud Vision API to take a PDF file and export it as a searchable PDF which might resolve this issue. I recommend you to subscribe to the Feature Request (click on the star next to the title) so it can get more visibility.
In the meantime, you can check the documentation on PDFs recognition to try it out and see if you can get the desired behavior.
If the forms you are working with have a determined format, you might be able to solve the issue by going through the TextAnnotation response from the API. The response gives you the text, plus additional insights on it, like the pages, paragraphs, etc.

Storing various data in a QR code

I want to put a web link, emailto link and some text into a QR code. The emailto field should also contain the subject and some body text. Example QR content (the link and mailto link should be clickable):
Some text
www.google.com
mailto:random#gmail.com?subject=SUBJECT_FIELD&body=BODY_TEXT
I tried creating a QR code as text. It didn't correctly interpret the mailto link. It does recognize the To: field, but not the subject and body parameter (probably because of the wrong interpretation of the ? and & signs). I know I could overcome this problem by shortening the mailto link with a url shortener, but I would like to avoid that.
I've also tried using the NTT DoCoMo MATMSG format, a multi URL QR code, a VCard, but nothing worked.
Does anybody know if this is even possible and how I could solve this?
Here's a QR code which uses Subject & Body - it seems to work perfectly with ZXing on Android.
However, QR codes generally only contain one piece of information. An email or a URL or some text. Trying to put different pieces of content into a QR code will lead to unpredictable behaviour.

How do I output the proper coded link with Yahoo Pipes

This all seems like it should be working to me but my appended "read more" link displays as plain text instead of as a link... Any insight or help on fixing this would be awesome! My pipe can be found at: http://pipes.yahoo.com/pipes/pipe.info?_id=1a22724d01568b8019be3125c7fb3075
The generated HTML in description looks good, however the Yahoo Pipes preview page strips all the HTML formatting, including the href you added.
I normally view RSS feeds in Google Reader. However Google Reader prefers to display the conetent:encoded field, which in your example, still contains the full description.
I modified your pipe to copy description to conetent:encoded:
http://pipes.yahoo.com/pipes/pipe.info?_id=eabe80102df76d1aee598648819be4a0
This renders correctly in Google Reader.

Drupal no www. linking

how can I disable automatically converting WWW.SOMETHING into a link in Drupal?
I just want to display URL , don't create a like.
This must be done per page, as some of the pages need to have it works as links.
so is there a special TAG or something to tell DRUPAL not to convert it to linkable text?
Auto conversion of URLs into links is handled by the "input format" specified for the node.
To avoid this happening for a specific node, create a new input format where the Url Filter is not enabled.
You can change the input format. Create one that matches your default and remove the URL filter (which is responsible for this). Then you can select it as input format for one node only, if you like.
The input format is probably the best solution, but a quick and dirty trick I have used on the rare occasion I needed to thwart auto-linking was to break up the non-url with formatting tags.
For example, if Drupal was converting www.foobar to a link, I would code the text as follows:
<i>www</i>.foobar
Not pretty, but I does the job if you are in a pinch.

Parsing PlainText Emails from HTML Content (ASP.NET)

Right, in short we basically already have a system in place where the HTML content for emails is generated. It's not perfect, but it works.
From this, we need to be able to derive a plaintext alternative for the email. I was thinking of instantly jumping on and creating a RegEx to strip the <*> tags from the message - but then I realised this would be no good because we do need some of the formatting information (paragraphs, line breaks, images etc).
NOTE: I am OK with actually sending the mail and setting up alternative views etc, this is only about getting plaintext from HTML.
So, I am pondering some ideas. Will post one as an answer to see what you guys think, but thought I would open it up to the floor. :)
If you need any more clarification then please shout.
Many thanks,
Rob
My Solution
OK, so here it is! I thought up a solution to my problem and it works like a charm!
Now, here are some of the goals I wanted to set out:
All the content for the emails should remain in the ASPX pages (as the HTML content currently does).
I didn't want the client code to do anything more other than say "SendMail("PageX.aspx")".
I didn't want to write too much code.
I wanted to keep the code as semantically correct as possible (no REALLY crazy-ass hacks!).
The Process
So, this is what I ended up doing:
Go to the master page for the email messages. Create an ASP.NET MultiView Control. This control would have two views - HTML and PlainText.
Within each view, I added content placeholders for the actual content.
I then grabbed all the existing ASPX code (such as header and footer) and stuck it in the HTML View. All of it, DocType and everything. This does cause VS to whinge a little bit. Ignore It.
I then of course added new content to the PlainText view to best replicate the HTML view in a PlainText environment.
I then added some code to the Master Page_Load, checking for the QueryString parameter "type" which could be either "html" or "text". It falls over to "text" if none present. Dependant on the value, it switches the view.
I then go to the content pages and add new placeholders for the PlainText equivalents and add text as required.
To make my life easier, I then overloaded my SendMail method to get the response for the required page, passing "type=html" and "type=text" and creating AlternateView's as appropriate.
In Summary
So, in short:
The Views seperate the actual "views" of the content (HTML and Text).
A master page auto switches the view based on a QueryString.
Content pages are responsible for how their views look.
Job done!
If any of this is unclear then please shout. I would like to create blog post on this at some point in more detail.
My Idea
Create a page based on the HTML content and traverse the control tree. You can then pick the text from the controls and handle different controls as required (e.g. use ALT text for images, "_____" for HR etc).
You could ensure the HTML mail is in XHTML format so you can parse it easily using the standard XML tools, then create your own DOM serialiser that outputs plain text. It'd still be a lot of work to cover general XHTML, but for a limited subset you plan to use in e-mail it could work.
Alternatively, if you don't mind shelling out to another program, you could just use the -dump switch to the lynx web browser.

Resources