Ejemplo n.º 1
0
        public byte[] GenerateFlyerByteContent(string dealerName, string htmlToConvert)
        {
            //// instantiate the HiQPdf HTML to PDF converter
            var htmlToPdfConverter = new HtmlToPdf();

            PDFHelper.ConfigureConverter(htmlToPdfConverter);
            PdfDocument pdfDocument = htmlToPdfConverter.ConvertHtmlToPdfDocument(htmlToConvert, null);

            FormatHeader(pdfDocument, dealerName);
            return(pdfDocument.WriteToMemory());
        }
Ejemplo n.º 2
0
        private static void FormatHeader(PdfDocument pdfDocument, string dealershipName, bool showDateTime)
        {
            pdfDocument.Header = pdfDocument.CreateHeaderCanvas(pdfDocument.Pages[0].DrawableRectangle.Width, 10);
            var sysFont = new Font("Times New Roman", 10, GraphicsUnit.Point);
            //pdfDocument.CreateFont(sysFont);
            PdfFont pdfFontEmbed = pdfDocument.CreateFont(sysFont, true);

            if (showDateTime)
            {
                pdfDocument.Header.Layout(new PdfText {
                    Text = DateTime.Now.ToShortDateString(), TextFont = pdfFontEmbed, HorizontalAlign = PdfTextHAlign.Right
                });
            }
            pdfDocument.Header.Layout(new PdfText {
                Text = dealershipName, TextFont = pdfFontEmbed, HorizontalAlign = PdfTextHAlign.Center
            });
        }
Ejemplo n.º 3
0
 public static void FormatHeader(PdfDocument pdfDocument, string dealershipName)
 {
     FormatHeader(pdfDocument, dealershipName, true);
 }