How can we convert the contents of the article into image/pdf format in drupal 7.
Suppose, we are viewing a article in some textformat (ie default format of drupal) and if we want to see the contents of article on a image format.
I'm dealing with content that is some value and can't be openly published without any security. Though i know its baseless to restrict others from copying the content, but still i like doing my own piece of work to stop content copying.
you can also use a module Cufon for text1 to image conversion
Related
I am reluctant to post this, but I am having trouble understanding how markdown actually "saves" to a database.
When I'm creating a migration, I will add columns and specify the type of value (i.e. integer, text, string, etc.) and in the course of operation on the website, users will input different information that is then saved in the DB. No problem there.
I just can't seem to wrap my head around the process for markdown. I've read about saving the HTML or saving the markdown file, rendering at runtime, pros and cons all that.
So, say I use an editor like Tiny MCE which attaches itself to a textarea. When I click "Submit" on the form, how does that operate? How does validation work? Feel free to answer my question directly or offer some resource to help further my understanding. I have an app built on Laravel so I'm guessing I'll need to use a package like https://github.com/GrahamCampbell/Laravel-Markdown along with an editor (i.e. Tiny MCE).
Thanks!
Let's start with a more basic example: StackOverflow. When you are writing/editing a question or answer, you are typing Markdown text into a textarea field. And below that textarea is a preview, which displays the Markdown text converted to HTML.
The way this works (simplified a little) is that StackOverflow uses a JavaScript library to parse the Markdown into HTML. This parsing happens entirely client side (in the browser) and nothing is sent to the server. With each key press in the textarea the preview is updated quickly because there is no back-and-forth with the server.
However, when you submit your question/answer, the HTML in the preview is discarded and the Markdown text from the textarea is forwarded to the StackOverflow server where is is saved to the database. At some point the server also converts the Markdown to HTML so that when another user comes alone and requests to view that question/answer, the document is sent to the user as HTML by the server. I say "at some point" because this is where you have to decide when the conversion happens. You have two options:
If the server converts the HTML when is saves it to the Database, then it will save to two columns, one for the Markdown and one of for the HTML. Later, when a user requests to view the document, the HTML document will be retrieved from the database and returned to the user. However, if a user requests to edit the document, then the Markdown document will be retrieved from the database and returned to the user so that she can edit it.
If the server only stores the Markdown text to the database, then when a user requests to view the document, the Markdown document will be retrieved from the database, converted to HTML and then returned to the user. However, if a user requests to edit the document, then the Markdown document will be retrieved from the database and returned to the user (skipping the conversion step) so that she can edit it.
Note that in either option, the server is doing the conversion to HTML. The only time the conversion happens client-side (in the browser) is for preview. But the "preview" conversion is not used to display the document outside of edit mode or to store the document in the database.
The only difference between something like StackOverflow and TinyMCE is that in TinyMCE the preview is also the editor. Behind the scenes the same process is still happening and when you submit, it is the Markdown which is sent to the server. The HTML used for preview is still discarded.
The primary concern when implementing such a system is that if the Markdown implementation used for preview is dissimilar from the implementation used by the server, the preview may not be very accurate. Therefore, it is generally best to choose two implementations that are very similar or, if available, use the same implementations for both.
It is actually very simple.
Historally, in forums, there used be BBCodes, which are basically pseudo-tags that allow you to format your text in some say. For example [b][/b] used to mean "make this text bold". In Markdown, it happens the exact same thing, but with other characters like *text* or **text**.
This happens so that you only allow your users to use a specific formatting, otherwise if you'd allow to write pure HTML, XSS (cross-site scripting) issues would arise and it's not really a good idea.
You should then save the HTML on the database. You can use, for example, markdown-js which is a Markdown parser that parses Markdown to HTML.
I have seen TinyMCE does not make use of Markdown by default, since it's simple a WYSIWYG editor, however it seems like it also supports a markdown-like formatting.
Laravel-Markdown is a server-side markdown render helper, you can use this on Laravel Blade views. markdown-js is instead client-side, it can be used, for example, to show a preview of what you're writing in real-time.
I want to display an image on our MediaWiki site using the description from its file description page as the caption in the syntax [[File:imagename.png|frame|caption]]. To clarify, I'm not trying to link to the image's description page.
I've read some things about querying the API on this question but I'm struggling to see how I can display the result of the query on the property (be it iiprop=comment or rvprop=content or...something else) in the source itself.
If this is a locally uploaded file, and your description pages don't have extraneous formatting, you could get away with something like this:
[[File:imagename.png|frame|{{File:imagename.png}}]]
But there's plenty of ways that can go wrong...
I have a Drupal 7 installation, multilingual. No matter which input format i'm choosing for the node body, every HTML tag is stripped. The input format is well configured. It's like Drupal always uses Plain Text as Filter, even if Full HTML is selected.
I found the answer in the Drupal Forum:
https://drupal.org/node/1829860
For the records: After some searching I found the culprit: I defined a
custom display setting for the content type article
(/admin/structure/types/manage/article/display) and changed (by
mistake) the field format to "plain text" for the body text. Reverting
to "default" fixed the problem.
I am trying to convert from html to pdf with Pandoc. The output is pretty nice, still with the command pandoc index.html -o output.pdfI lose all my internal links (from table of contents to chapters, from text to footnotes, etc).
In my HTML this is the outdegree link
<p class="calibre18"><span class="calibre8">CHAPTER ONE</span><br class="calibre19"></br>The Ever Expanding Domain of Computation</p>
which then lands here
Chapter 1 makes the case that because of...
and here
<p class="calibre18"><span class="calibre8">CHAPTER ONE</span><br class="calibre19"></br>The Ever Expanding Domain of Computation</p>...
Is there any way to keep all the links also in the output?
The Pandoc User's Guide section on Internal Links says
Internal links are currently supported for HTML formats (including HTML slide shows and EPUB), LaTeX, and ConTeXt.
This suggests that internal links aren't currently supported for PDF output, even though the PDF output is generated via LaTeX.
Internal links should work straightforwardly in PDF. However, for printing purposes, the default is not to color them. Have you tried clicking on the text that should be a link?
I'm designing a news-reading app and using the NavigateToString() of a webbrowser to show some string. Now I want to implement the off-line reading function, the html string had already been downloaded, except the image.
Windows phone has implemented the image-cache function, once the Image is requested, it had been cached. But now problem is that, all the html strings are stored in a array, some of those html strings hadn't been shown throught the navigateToString(), namely the imgs in those string couldn't show up if the internet is disconnected.
So I'm wondering how to cache the imgs in the webbrowser?
thanks,
ellic
It ain't gonna be easy or pretty.
Here's one thing you can do...
Parse the HTML using something like the HtmlAgilityPack. Linq should be a good solution for finding all the images. If you want to use xpath, you can do that too.
Find all Images in the HTML and use a WebClient (or better yet, a WebRequest) to fetch them.
Save them as part of your database that you use to store your HTML strings (say, Base64 encoded if your medium needs to be strings, key'ed by the URI to the image);
When you want to display the offline HTML, again, parse the HTML and replace all references to images with the data protocol equivalent of your cached images.