Hi
Hi Edward,
string outFile =
myDir+“output.pdf”;<o:p></o:p>
string inFile = myDir + "test.bmp";
Document doc = new Document();
Page page = doc.Pages.Add();
//LOGO
Aspose.Pdf.Image logo = new Aspose.Pdf.Image();
logo.File = inFile;
page.Paragraphs.Add(logo);
//TITLE
TextFragment pdfHeadTitle = new TextFragment(string.Format("{0}", "internalTest.TestTemplate.Name"));
pdfHeadTitle.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center;
pdfHeadTitle.TextState.Font = FontRepository.FindFont("Arial");
pdfHeadTitle.TextState.FontStyle = FontStyles.Bold;
pdfHeadTitle.TextState.FontSize = 16;
pdfHeadTitle.TextState.LineSpacing = 20;
page.Paragraphs.Add(pdfHeadTitle);
String date_new;
int count = 1;
date_new = string.Format("Test creation Date: {0}", DateTime.Now.ToString("dd/MM/yyyy"));
//Counter
TextFragment pdfHeadCount = new TextFragment(count.ToString());
pdfHeadCount.TextState.Font = FontRepository.FindFont("Arial");
pdfHeadCount.TextState.FontStyle = FontStyles.Bold;
pdfHeadCount.TextState.FontSize = 12;
pdfHeadCount.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right;
pdfHeadCount.TextState.LineSpacing = 5;
page.Paragraphs.Add(pdfHeadCount);
//Date
TextFragment pdfHeadDate = new TextFragment(date_new);
pdfHeadDate.TextState.Font = FontRepository.FindFont("Arial");
pdfHeadDate.TextState.FontStyle = FontStyles.Bold;
pdfHeadDate.TextState.FontSize = 12;
pdfHeadDate.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right;
pdfHeadDate.TextState.LineSpacing = 5;
page.Paragraphs.Add(pdfHeadDate);
for (int question = 0; question <= 5; question++)
{
Aspose.Pdf.Heading headingQ = new Aspose.Pdf.Heading(1);
headingQ.Text = "Sample(question.Text)";
headingQ.TextState.Font = FontRepository.FindFont("Arial");
headingQ.TextState.FontSize = 10;
headingQ.TextState.FontStyle = FontStyles.Bold;
headingQ.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;
headingQ.TextState.LineSpacing = 3;
headingQ.Margin = new Aspose.Pdf.MarginInfo();
headingQ.Margin.Top = 10;
headingQ.IsAutoSequence = true;
page.Paragraphs.Add(headingQ);
for (int internalAnswer = 0; internalAnswer <= 5; internalAnswer++)
{
Aspose.Pdf.Heading headingA = new Aspose.Pdf.Heading(2);
headingA.Text = "(internalAnswer.Text)";
headingA.TextState.Font = FontRepository.FindFont("Arial");
headingA.TextState.FontSize = 10;
headingA.TextState.FontStyle = FontStyles.Bold;
headingA.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify;
headingA.TextState.LineSpacing = 3;
headingA.Margin = new Aspose.Pdf.MarginInfo();
headingA.Margin.Left = 12;
headingA.Margin.Top = 5;
page.Paragraphs.Add(headingA);
}
}
doc.Save(outFile);
Please feel free to contact us for any further assistance.
Best Regards,