예제 #1
0
        protected string Convertir_HTMLaPDF(string Archivo, string CodigoHTML)
        {
            string ArchivoR = "";

            try
            {
                object TargetFile       = Archivo;
                string ModifiedFileName = string.Empty;
                string FinalFileName    = string.Empty;

                HtmlToPdfBuilder builder = new HtmlToPdfBuilder(iTextSharp.text.PageSize.LETTER);
                HtmlPdfPage      first   = builder.AddPage();
                first.AppendHtml(CodigoHTML);
                byte[] file = builder.RenderPdf();
                System.IO.File.WriteAllBytes(TargetFile.ToString(), file);

                ArchivoR = EncriptarPDF(Archivo);
            }
            catch (Exception ex)
            {
                ArchivoR = "Error: " + ex.Message;
            }

            return(ArchivoR);
        }
예제 #2
0
 /// <summary>
 /// Moves a page after another
 /// </summary>
 public void InsertAfter(HtmlPdfPage page, HtmlPdfPage after)
 {
     this._Pages.Remove(page);
     this._Pages.Insert(
         Math.Min(this._Pages.IndexOf(after) + 1, this._Pages.Count),
         page);
 }
예제 #3
0
 /// <summary>
 /// Moves a page before another
 /// </summary>
 public void InsertBefore(HtmlPdfPage page, HtmlPdfPage before)
 {
     this._Pages.Remove(page);
     this._Pages.Insert(
         Math.Max(this._Pages.IndexOf(before), 0),
         page);
 }
예제 #4
0
        /// <summary>
        /// Appends and returns a new page for this document
        /// </summary>
        public HtmlPdfPage AddPage()
        {
            HtmlPdfPage page = new HtmlPdfPage();

            this._Pages.Add(page);
            return(page);
        }
예제 #5
0
 /// <summary>
 /// Removes the page from the document
 /// </summary>
 public void RemovePage(HtmlPdfPage page)
 {
     this._Pages.Remove(page);
 }