예제 #1
0
        public void SaveDocument()
        {
            int questionNumber = 1;

            foreach (var question in _questions)
            {
                var currentAnswerPositions = new LinkedList <AnswerPositionDTO>();
                var table = PDFHelpers.PDFTableCreator(question, questionNumber++);
                _document.Add(table);
                currentAnswerPositions = PDFHelpers.CreateAnswerPositionList(ExamID, table, question, _document, _writer);

                _examAnswerPositions.AddRange(currentAnswerPositions);
            }
            _document.Close();
        }
예제 #2
0
        public PDFDocument(ExamDTO examDTO, string path)
        {
            _document = new Document(PageSize.A4, 36, 36, 36, 36);

            _examID   = examDTO.Id;
            _filename = examDTO.StudentFullName + PDFHelpers.GetMD5(_examID.ToString()) + ".pdf";
            _filepath = path + "\\";

            _writer           = PdfWriter.GetInstance(_document, new FileStream(_filepath + _filename, FileMode.Create));
            _writer.PageEvent = PDFHelpers.CreatePageEventHelper(examDTO);
            _document.Open();

            _questions           = new LinkedList <QuestionDTO>(examDTO.QuestionsDTO);
            _examAnswerPositions = new List <AnswerPositionDTO>();
        }