how to generate pdf in asp net mvc : Convert pdf file to text file SDK Library service wpf asp.net web page dnn moodle0-part1587

The moodle package:
generating Moodle quizzes via L
A
T
E
X
Anders Hendrickson
St.Norbert College,De Pere, WI,USA
anders.hendrickson@snc.edu
January 11, 2016
1 Motivation
The acronym Moodle stands for \Modular Object-Oriented Dynamic Learn-
ing Environment." It is an open source learning management system em-
ployed by many universities, colleges, and high schools to provide digital ac-
cess to course materials, suchas notes, video lectures, forums, and the like; see
https://moodle.com/moodle-lms/ for more information. One of the manyuse-
fulfeaturesofMoodleisthatmathematicalandscienticnotationcanbeentered
inL
A
T
E
Xor T
E
Xcode, whichwill be typeset either through abuilt-inT
E
Xlter
orby invokingMathJax.
For instructors who want to give students frequent feedback, but lack the
time to do so, a particularly valuable module in Moodle is the quiz. A Moodle
quiz can consist of several dierent typesof questions|not only multiple choice
or true/false questions, but also questionsrequiringa short phrase or numerical
answer, and even essay questions. Allbut the essay questionsare automatically
gradedbythesystem, andtheinstructor hasfullcontrolover howoftenthequiz
maybeattempted,itsduration,andsoforth. Feedbackcanbetailoredtospecic
mistakesthe studentmakes.
All these features make Moodle quizzes very useful toolsfor instructorswho
have accesstothem. Unfortunately, the primary way to create or edit aMoodle
quiz is through a web-based interface that can be slow to operate. To users
of LAT
E
X, accustomed to the speed of typing source code on a keyboard alone,
the agonizing slowness of switching between mouse and keyboard to navigate a
web form with its myriad dropdown boxes, radio buttons, compounded with a
perceptible time lag as one’s Moodle server responds to requests, can produce
a very frustrating experience. Moreover, editing is entirely impossible without
networkaccess.
Thisdocumentcorrespondstomoodle.sty v0.5,dated2016/01/11.
1
Convert pdf file to text file - SDK Library service:C# PDF Convert to Text SDK: Convert PDF to txt files in C#.net, ASP.NET MVC, WinForms, WPF application
C# PDF to Text (TXT) Converting Library to Convert PDF to Text
www.rasteredge.com
Convert pdf file to text file - SDK Library service:VB.NET PDF Convert to Text SDK: Convert PDF to txt files in vb.net, ASP.NET MVC, WinForms, WPF application
VB.NET Guide and Sample Codes to Convert PDF to Text in .NET Project
www.rasteredge.com
Once the quiz iswritten, there isnoeasy way to viewand proofreadall the
informationof whichit ismade. Eachquestioniseditedona separatewebpage,
whichissofullofoptionsthatitcannotbeviewedonasinglescreen. Aninstructor
has to spend much time checking over the newly created quiz in order to be
condent therearenoerrors.
Addedtoallthisisthefrustrationofmanaginggraphics. Ifaquestionrequires
animage|say,askingacalculusstudenttointerpretthegraphofafunction|the
image must rstbe producedasastandalone le(e.g.,inJPGor PNGformat),
uploadedtoMoodle,andthenchosenina web-basedHTMLeditor. Greatisthe
vexationof theinstructor whodecidedtoalteraquestion,astherearemore and
morepossibilitiesof errorwhenevermultiplelesmust bekeptsynchronized.
Users of LAT
E
X are also accustomed to the speed and  exibility that comes
from dening their ownmacros, whichmay be asbrief as writing \R instead of
\mathbb{R}orascomplexasmacrosthatgenerateentireparagraphsoftext. The
Moodleeditor,bycontrast,requiresyoutotype\mathbb{R}everysingletimeyou
wantR.
Finally,thereisthequestionofarchivingandreusingone’swork. Much,much
work goes into creating Moodle quizzes, which then reside on a Moodle server
somewhereinthecloudinaformatneithereasilybrowsablenoreasilymodiable.
LAT
E
Xitself hasthe power tosolve allthesediculties: it isswift toedit and
swifter to compile a L
A
T
E
X document, and the PDF may be previewed onscreen
orprintedout for ease of proofreading. Mathematicalgraphicscanbeintegrated
withinthemainlethroughTikZ,andofcourseL
A
T
E
Xmacroscanbecustomized.
Usingthepresent moodle.stypackage,aquizauthorcantypeaquizusingfamiliar
L
A
T
E
X syntax and document structure. Upon compilation, L
A
T
E
X will generate
bothawell-organizedPDFthatiseasytoproofreadandanXMLlethatcanbe
uploadeddirectly toMoodle. The entire processisfarfaster thanusingMoodle’s
ownweb-based editor, makesit easier tocatchone’smistakes,and the ultimate
source code of one’s work is a human-readable .tex le that can be archived,
browsed,andeditedoine.
2 Work ow
Theprocessof creating aquizinMoodleusingthispackageisasfollows:
1. WriteaLAT
E
Xdocument using\usepackage{moodle} asdescribedbelow.
2. Compile the document toPDF using pdfL
A
T
E
X. Thiswillalsoproduce the
le hjobnamei-moodle.xml.
3. Open Moodle, navigate to the desiredcourse, andunder \Question bank"
select\Import."
4. Select \Moodle XML format," choose the XML le to upload, and press
\Import."
5. After Moodle veriesthat thequestionshave been importedcorrectly,you
may addthem toyourquizzes.
2
SDK Library service:VB.NET PDF File Compress Library: Compress reduce PDF size in vb.
Convert smooth lines to curves. Detect and merge image fragments. Flatten visible layers. VB.NET Demo Code to Optimize An Exist PDF File in Visual C#.NET Project
www.rasteredge.com
SDK Library service:C# PDF File Split Library: Split, seperate PDF into multiple files
Application. Best and professional adobe PDF file splitting SDK for Visual Studio .NET. outputOps); Divide PDF File into Two Using C#.
www.rasteredge.com
3 Usage
3.1 Example Document
Thefollowingpagespresumethereaderalreadyhassomefamiliaritywithcreating
and editing Moodle quizzesthroughthe webinterface. The xkeyval package is
usedtoprovide akey-valueinterface. Hereisasimpleexampledocument:
\documentclass[12pt]{article}
\usepackage{moodle}
\begin{document}
\begin{quiz}{My first quiz}
\begin{numerical}[points=2]{Basic addition}
What is $8+3$?
\item 11
\end{numerical}
\begin{shortanswer}[case sensitive=true]{Newton’s name}
What was Newton’s first name?
\item Isaac
\item[fraction=0, feedback={No, silly!}] Fig
\item{fraction=0} Sir
\end{shortanswer}
\begin{multi}[points=3]{A first derivative}
What is the first derivative of $x^3$?
\item $\frac{1}{4} x^4+C$
\item* $3x^2$
\item $51$
\end{multi}
\end{quiz}
\end{document}
Key features to note inthis rst example are that a quiz environment contains
several question environments. Each question takesa name as a mandatory ar-
gument,anditmayalsotake optionalkey-value argumentswithinbrackets. The
questionenvironmentsresemblelistenvironmentssuchasitemizeorenumerate,
inthatanswersaresetoby\item’s,butthequestionitselfisthetextthatoccurs
before the rst \item.
Ifthepackageoptiondraftisinvoked,bycalling\usepackage[draft]{moodle},
draft
thennoXMLlewill be generated. Thisisespecially usefulwhile editingaquiz
containinggraphics, soastoavoidthetime spent converting imageles.
3
SDK Library service:VB.NET PDF File Merge Library: Merge, append PDF files in vb.net
Professional VB.NET PDF file merging SDK support Visual Studio .NET. Merge PDF without size limitation. Append one PDF file to the end of another one in VB.NET.
www.rasteredge.com
SDK Library service:VB.NET PDF File Split Library: Split, seperate PDF into multiple
Professional VB.NET PDF file splitting SDK for Visual Studio and .NET framework 2.0. Split PDF file into two or multiple files in ASP.NET webpage online.
www.rasteredge.com
3.2 Quiz and Question Environments
A .tex document to generate Moodle quizzes contains one or more quiz envi-
quiz
ronments, withinwhich variousquestionenvironmentsare nested. The required
argumenttothequizenvironmentnamesthe\questionbank"towhichtheques-
tionsinsidewillbelong after beinguploadedtomoodle.
\begin{quiz}[hoptionsi]{hquestionbanknamei}
Therearenoquiz-specicoptions,butanyhoptionsi setwith\begin{quiz}will
beinheritedbyallquestionscontainedwithinthat quiz environment.
Options may also be set at any time with \moodleset{hoptionsi}; these
\moodleset
changesarelocal toT
E
X-groups.
Thesyntax for eachquestionenvironment is
\begin{hquestiontypei}[hquestionoptionsi]{hquestionnamei}
hquestiontexti
\itemhitemi
.
.
.
\itemhitemi
\end{hquestiontypei}
Themeaningofthehitemisvariesdependingonthequestiontype,buttheyusually
areanswersto thequestion. Detailswillbegivenbelow.
Thefollowingkey-valueoptionsmay be setfor allquestions:
By default,eachquestionisworth1 point onthequiz. Thismay bechanged
points
default grade
with the points key or its synonym, default grade; for example, points=2
makesthat questionworthtwopoints.
Thepenaltyisthefractionofpointsthat istakenoforeachwrongattempt;
penalty
itmaybeset toanyvaluebetween0and1. Thedefault ispenalty=0.10.
In most question types, it is possible to designate some answers as being
fraction
worthpartial credit|that is, some fractionof a completely correct answer. The
fractionkey may be set toany integer from0 (entirelywrong) to100 (entirely
correct).
The feedback key sets text that will appear to the student after completing
feedback
the quiz. Forexample,onemightset
feedback={A question like this will appear on the exam.}
Thedesiredfeedbackshouldbe includedinbraces.
Twokindsoffeedbackcanbegiven. Ifthefeedbackkey issetforaquestion,
thenthatfeedbackwillappeartoeachstudentregardlessofthestudent’sanswer.
Answer-specic feedback (perhaps explaining a common mistake) may also be
givenbysetting the feedback key atthe individualanswer.
4
SDK Library service:C# PDF File Merge Library: Merge, append PDF files in C#.net, ASP.
document file, and choose to create a new PDF file in .NET deleting, PDF document splitting, PDF page reordering and PDF page image and text extraction.
www.rasteredge.com
SDK Library service:C# PDF File Compress Library: Compress reduce PDF size in C#.net
All object data. File attachment. Hidden layer content. Convert smooth lines to curves. Flatten visible layers. C#.NET DLLs: Compress PDF Document.
www.rasteredge.com
3.3 Question Types
We next discussthe various questiontypessupportedby moodle.sty and the op-
tionsthatmaybeset.
3.3.1 Multiple Choice
Thesyntaxforaclassicmultiplechoicequestion,withonlyonecorrect answer,is
multi
asfollows:
\begin{multi}[hquestionoptionsi]{hquestion namei}
hquestiontexti
\item*hcorrect answeri
\item[hoptionsi]hwrong answeri
.
.
.
\item[hoptionsi]hwrong answeri
\end{multi}
The correct answer is designated by the asterisk * after the \item; it need not
appear rstinthe list.
Thebooleankey shuffledetermineswhetherMoodlewillrearrangethepos-
shuffle
sibleanswersinarandom order. Settingshuffle=false willguarantee that the
answer appear intheorder they weretyped;thedefault isshuffle=true.
Moodle oersdierent optionsfor numberingthepossible answers. Youmay
numbering
setthenumberingkeytoanyofthefollowingvalues,whichmirrortheusualL
A
T
E
X
syntax: alph, Alph, arabic, roman, Roman, and none. Calling numbering=none
produces an unnumberedlist of answers. The Moodle syntax of abc, ABC, 123,
iii, and IIII is also acceptable, but note that it requires four I’s to obtain
upper-caseRomannumeralsthisway.
Thefractionkeycanbeusedtodesignatesomewronganswersasbeingworth
fraction
partialcredit. Forexample,aquestionmight readthus:
\begin{multi}{my question}
Compute $\int 4x^3\,dx$.
\item* $x^4+C$
\item[fraction=50] $x^4$
\item $12x^2$
\end{multi}
Thus the asterisk * is shorthand for fraction=100, whereas a bare \item sets
fraction=0.
By default, the multienvironment producesamultiple choicequestionoper-
single
multiple
ateswithonly onecorrect answer;thisiscalledsingle mode, andonMoodle it
appearswithradio buttons. Itisalsopossibletowrite questionswithmorethan
one correct answer, askingthe user to check all correct answers. To dothis, use
the key multipleorsingle=false.
5
SDK Library service:C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
Convert PDF to Tiff. Convert PDF to HTML. Convert PDF to SVG. Convert PDF to Text. Convert PDF to Jpeg. Convert PDF to Png, Gif, Bitmap Images. File and Page
www.rasteredge.com
SDK Library service:C# PDF Text Extract Library: extract text content from PDF file in
C#.NET PDF text extracting library package, you can easily extract all or partial text content from target PDF document file, edit selected text content, and
www.rasteredge.com
Theworthofeachcorrectanswersinmultiplemodemaybesetbyfraction,
butMoodlewillrequirethatallthefractionsadduptoatleast100. Ifyousimply
designateeachcorrect answer with \item*, thenmoodle.sty willdividethe100%
equally among those answers. For example, the following twoexamplesproduce
equivalent results:
\begin{multi}[multiple]{my question}
Which numbers are prime?
\item* 5
\item 6
\item* 7
\item 8
\end{multi}
\begin{multi}[multiple]{my question}
Which numbers are prime?
\item[fraction=50] 5
\item 6
\item[fraction=50] 7
\item 8
\end{multi}
3.3.2 Numerical
Anumerical question in Moodle requiresthe student to input a real number in
decimal form. Itstypicalformatis
\begin{numerical}[hquestionoptionsi]{hquestionnamei}
hquestiontexti
\item[hoptionsi]hcorrectansweri
\end{numerical}
If there is more than one correct answer, additional \item’s may be included.
Becausethisisnotamultiplechoicequestion,thereisnoneedtoprovideincorrect
answers. There may nevertheless be reasons to include incorrect answers. For
example, partiallycorrect answersmay bespeciedbysettingthe fractionkey.
Feedback for acommonmistake may be given by includingthe incorrect answer
likethis:
\item[fraction=0,feedback={You forgot to antidifferentiate!}]hincorrectansweri
6
SDK Library service:VB.NET PDF Text Extract Library: extract text content from PDF
Extract and get partial and all text content from PDF file. Extract highlighted text out of PDF document. Extract Text Content from PDF File in VB.NET.
www.rasteredge.com
SDK Library service:Online Convert PDF to Text file. Best free online PDF txt
from other C# .NET PDF to text conversion controls, RasterEdge C# PDF to text converter control toolkit can convert PDF document to text file with good
www.rasteredge.com
3.3.3 Short Answer
Ashort answerquestionresemblesanumericalquestion: thestudent istollina
text boxwithamissingwordor phrase.
\begin{shortanswer}[hquestionoptionsi]{hquestionnamei}
hquestiontexti
\item[hoptionsi]hcorrectansweri
.
.
.
\item[hoptionsi]hcorrectansweri
\end{shortanswer}
Youcanmakethetextboxappearaspartofthequestionwiththecontrolsequence
\blank. Forexample,your questionmight read
\begin{shortanswer}{Leibniz}
Newton’s rival was Gottfried Wilhelm \blank.
\item Leibniz
\item Leibniz.
\end{shortanswer}
Notethatastheblankoccurredattheendofasentence,weincludedtwoanswers,
leststudentsgetthequestionwrongmerelybyincludingoromittingaperiod.
By default,Moodleignoresthedistinctionbetweenupper-andlower-caselet-
case sensitive
usecase
terswhengradingashortanswerquestion. Youcanmakeaquestioncase-sensitive
withthekeycase sensitiveoritsshorter synonym usecase.
3.3.4 Essay Questions
InstructorsmayaskessayquestionsonaMoodlequiz,althoughMoodle’ssoftware
isnot up to the task of gradingthem! Instead eachessay questionanswer must
begradedmanuallybytheinstructor or ateachingassistant.
\begin{essay}[hquestionoptionsi]{hquestion namei}
hquestiontexti
\item[hoptionsi]hnotesforgraderi
.
.
.
\item[hoptionsi]hnotesforgraderi
\end{essay}
Insteadofcontaininganswers,the\itemtagsfortheessayquestioncontainnotes
that willappear towhoever isgradingthequestionmanually.
AlthoughMoodlecannotgradethecontentofanessayquestion,itcanatleast
response required
determine whether the questionhasbeen left blank. If the response required
key isset,Moodlewillinsistthat thestudententer somethingintheblank before
acceptingthe quizascompleted.
7
Moodle oers ve dierent ways for students to enter and/or upload their
response format
answerstoanessay question. Youmay chooseoneoftheseve options:
html Aneditorwiththeability toformatHTMLresponsesincludingmarkupfor
italics,boldface,etc. Thisisthedefault.
file A le picker allowing thestudent touploada le, suchasa PDFor DOC
le,containingthe essay.
html+file The sameHTMLeditor asabove,but withtheabilitytouploadles
aswell. Thispermitssome studentstotype answers directly into the web
form,andotherstocompose theiressaysinanother programrst.
text Thiseditorallowsonly for enteringplaintextwithout any markup.
monospaced Thisyieldsaplaintexteditor,withoutanymarkup,andwithaxed-
widthfont. Thiscouldbeusefulforentering codesnippets,forexample.
The key response field lines controls the height of the input box. The
response field lines
default isresponse field lines=15.
The attachments allowed key controls how many attachmentsa student is
attachments allowed
allowedtoupload. Permissiblevaluesare 0,1,2,3,or unlimited.
Youmay also require the student touploada certainnumber of attachments
attachments required
bysettingattachments required to0,1,2,or 3.
Finally, youmay preloadtheessayquestionwitha templatethat the student
response template
willedit and/or type over, withthe key response template={htemplatei}. The
htemplatei shouldbe enclosedinbraces.
3.4 Matching Questions
Amatching questionoersa seriesof subquestionsanda set of possibleanswers
fromwhichtochoose. Iftherearemquestionsandnpossibleanswers,amatching
questionwilllook likethis:
\begin{matching}[hquestionoptionsi]{hquestionnamei}
hquestiontexti
\item[hoptionsi]hquestion 1i \answerhanswer1i
\item[hoptionsi]hquestion 2i \answerhanswer2i
.
.
.
\item[hoptionsi]hquestion mi \answerhanswermi
\item[hoptionsi]\answerhanswer m+1i
.
.
.
\item[hoptionsi]\answerhanswer ni
\end{matching}
Answers1throughmcorrespondtoquestions1throughm;answersm+1through
nare\decoy"answers. Ifmultiplequestionsshouldhavethesameanswer,besure
8
yourtypedanswermatchexactly,sothatMoodle willnot createduplicatecopies
ofthesameanswer!
The matching question acceptsthe option of shuffle to randomly permute
shuffle
the questionsandanswers; bydefault shuffle=true.
Moodlehastwoformatsformatchingquestions. Theoldermatchingquestion
drag and drop
dd
oeredadropdownboxforchoosingtheanswertoeachquestion;thenewer\drag
and drop matching" format showsall questions in one column, all answers ina
second column, and allowsstudentsto drag the correct answer to the question
usingamouse. Toenable drag-and-dropmatching, use the key‘drag and drop’
or ‘dd’ for short. The default is dd=false. If youchoose the older format,then
duetothelimitationsof dropdownboxes,noLAT
E
Xor HTMLcode canbe used
intheanswers.
3.5 Cloze Questions
A \cloze question" has one or more subquestions embedded within a passage
of text. For example, you might ask students to ll in several missing words
within a sentence, or calculate several coecients of a polynomial. To encode
cloze questionsinL
A
T
E
Xusing thispackageiseasy: yousimply nest one ormore
multi,shortanswer,ornumericalenvironmentswithinaclozeenvironment,as
inthefollowingexample:
\begin{cloze}{my cloze question} \\
Thanks to calculus, invented by Isaac
\begin{shortanswer}
\item Newton
\end{shortanswer},
we know that the derivative of $x^2$ is
\begin{multi}[horizontal]
\item $2x$
\item* $\frac{1}{3} x^3 + C$
\item $0$
\end{multi}
and that $\int_0^2 x^2\,dx$ equals
\begin{numerical}
\item[tolerance=0.0004] 2.667
\end{numerical}.
Thanks, Isaac!
\end{cloze}
Note that when used as a subquestion within a cloze question, \begin{multi}
is not followed by name in braces; the same is true for the shortanswer and
numericalenvironments.
Withinacloze question,by defaultamultiplechoice questionisimplemented
vertical
horizontal
as an inline dropdown box. This is visually compact, but it also prevents the
useofmathematical or HTMLformatting. Addingthe optionvertical displays
the subquestionasaverticalcolumnofradiobuttonsinstead;likewisetheoption
horizontalcreatesa horizontalrowofradiobuttons.
9
4 Conversion to HTML
QuestionsshouldbetypedasusualforLAT
E
X,including\$toobtaindollar signs,
$’s for math shifts, $$’s for display math, et cetera. The package moodle.sty
automatically convertsthisLAT
E
XcodeintoHTMLfor webdisplay.
ThefollowingtablelistsLAT
E
Xcommandsandenvironmentsthat willbecon-
vertedtoHTML:
~
\#
\$
\&
\\
\S
\{
\}
\emph
\textbf
\par
\ldots
\dots
\relax
\euro
\texteuro
\begin{center}
\begin{enumerate}
\begin{itemize}
\begin{tikzpicture}
Singleanddoublequotationmarksandthe diacriticalcommands \^, \’,\‘, \",
\~,and\Harealsohandled,asarethecharacters\aa,\ae,\o,\ss,\l,andtheir
capitalizations.
In addition, < and > will be converted to &lt; and &gt; within math mode
only. If theyshouldbetypedoutsideof mathmode,theywillbepassedastyped
tothe HTML,andprobablyinterpretedby students’ browsersasHTMLtagsor
other unpredicatedresults.
Beawarethatmoodle.stydoesnotknowhowtoconvertanyotherT
E
XorLAT
E
X
commands to HTML. If other sequencesare used, they may be passed verbatim
totheXMLleor maycause unpredictedresults.
Ifyouthinkofanother LAT
E
Xcommandthat shouldbechangedtoanHTML
equivalent,pleasecontact theauthor at anders.hendrickson@snc.edusothat it
may be addedtoafuture revisionof the package.
5 Graphics
The moodle.sty package can handle two kinds of graphics seamlessly. External
graphics les may be included with the \includegraphics command from the
graphicx package, and graphicsmay be generatedinternally using TikZ. Inei-
ther case,the graphicswill be embeddedinbase-64encodingdirectly within the
Moodle XMLproduced. Thisprevents the hassle of managingseparate graphics
lesontheMoodleserver,asMoodle willstorethepicturewithinthequestionin
the questionbank.
When using \includegraphics, the only options currently supported are
\includegraphics
height
width
height and width. Attemptsto use other \includegraphics options, such as
scaleorangle,willaectthePDFbutnottheXMLoutput. Thedimensionsset
byheight andwidth are T
E
Xdimensionssuchas4inor 2.3cm. Inorderto pre-
pare the imagefor webviewing,thispackage convertsthose dimensionstopixels
10
Documents you may be interested
Documents you may be interested