public void DrawWebLink(float x, float y, string webLink, string linkText, PdfFont font = null, PdfGraphics graphics = null) { font = font ?? NormalFont; graphics = graphics ?? CurrentPageGraphics; PdfTextWebLink textLink = new PdfTextWebLink(); textLink.Url = webLink; textLink.Text = linkText; textLink.Font = font; textLink.DrawTextWebLink(graphics, new PointF(x, y)); }
public void DrawWebLinkPageBottom(float x, float yOffset, string webLink, string linkText, PdfFont font = null) { font = font ?? NormalFont; float y = CurrentPage.Graphics.ClientSize.Height - yOffset; PdfTextWebLink textLink = new PdfTextWebLink(); textLink.Url = webLink; textLink.Text = linkText; textLink.Font = font; textLink.DrawTextWebLink(CurrentPageGraphics, new PointF(x, y)); }
public PdfLayoutResult AddWebLink(string webLink, float x, float y, string linkText, PdfFont font = null, bool xIsRightOffset = false, float?forceTextSize = null) { font = font ?? NormalFont; PdfTextWebLink textLink = new PdfTextWebLink(); textLink.Url = webLink; textLink.Text = linkText; textLink.Font = font; if (xIsRightOffset) { SizeF textSize = font.MeasureString(webLink); float textWidth = forceTextSize ?? textSize.Width; x = PageWidth - textWidth - x; } var result = textLink.DrawTextWebLink(CurrentPage, new PointF(x, y)); return(result); }
public ActionResult InteractiveFeatures(string InsideBrowser) { #region Field Definitions document = new PdfDocument(); document.PageSettings.Margins.All = 0; document.PageSettings.Size = new SizeF(PdfPageSize.A4.Width, 600); interactivePage = document.Pages.Add(); PdfGraphics g = interactivePage.Graphics; RectangleF rect = new RectangleF(0, 0, interactivePage.Graphics.ClientSize.Width, 100); PdfBrush whiteBrush = new PdfSolidBrush(white); PdfPen whitePen = new PdfPen(white, 5); PdfBrush purpleBrush = new PdfSolidBrush(new PdfColor(255, 158, 0, 160)); PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 25); Syncfusion.Drawing.Color maroonColor = Color.FromArgb(255, 188, 32, 60); Syncfusion.Drawing.Color orangeColor = Color.FromArgb(255, 255, 167, 73); #endregion #region Header g.DrawRectangle(purpleBrush, rect); g.DrawPie(whitePen, whiteBrush, new RectangleF(-20, 35, 700, 200), 20, -180); g.DrawRectangle(whiteBrush, new RectangleF(0, 99.5f, 700, 200)); g.DrawString("Invoice", new PdfStandardFont(PdfFontFamily.TimesRoman, 24), PdfBrushes.White, new PointF(500, 10)); string basePath = _hostingEnvironment.WebRootPath; string dataPath = string.Empty; dataPath = basePath + @"/PDF/"; //Read the file FileStream file = new FileStream(dataPath + "AdventureCycle.jpg", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); g.DrawImage(PdfImage.FromStream(file), new RectangleF(100, 70, 390, 130)); #endregion #region Body //Invoice Number Random invoiceNumber = new Random(); g.DrawString("Invoice No: " + invoiceNumber.Next().ToString(), new PdfStandardFont(PdfFontFamily.Helvetica, 14), new PdfSolidBrush(maroonColor), new PointF(50, 210)); g.DrawString("Date: ", new PdfStandardFont(PdfFontFamily.Helvetica, 14), new PdfSolidBrush(maroonColor), new PointF(350, 210)); //Current Date PdfTextBoxField textBoxField = new PdfTextBoxField(interactivePage, "date"); textBoxField.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12); textBoxField.Bounds = new RectangleF(384, 204, 150, 30); textBoxField.ForeColor = new PdfColor(maroonColor); textBoxField.ReadOnly = true; document.Actions.AfterOpen = new PdfJavaScriptAction(@"var newdate = new Date(); var thisfieldis = this.getField('date'); var theday = util.printd('dddd',newdate); var thedate = util.printd('d',newdate); var themonth = util.printd('mmmm',newdate); var theyear = util.printd('yyyy',newdate); thisfieldis.strokeColor=color.transparent; thisfieldis.value = theday + ' ' + thedate + ', ' + themonth + ' ' + theyear ;"); document.Form.Fields.Add(textBoxField); //invoice table PdfLightTable table = new PdfLightTable(); table.Style.ShowHeader = true; g.DrawRectangle(new PdfSolidBrush(Syncfusion.Drawing.Color.FromArgb(238, 238, 238, 248)), new RectangleF(50, 240, 500, 140)); //Header Style PdfCellStyle headerStyle = new PdfCellStyle(); headerStyle.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12, PdfFontStyle.Bold); headerStyle.TextBrush = whiteBrush; headerStyle.StringFormat = new PdfStringFormat(PdfTextAlignment.Center); headerStyle.BackgroundBrush = new PdfSolidBrush(orangeColor); headerStyle.BorderPen = new PdfPen(whiteBrush, 0); table.Style.HeaderStyle = headerStyle; //Cell Style PdfCellStyle bodyStyle = new PdfCellStyle(); bodyStyle.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 10); bodyStyle.StringFormat = new PdfStringFormat(PdfTextAlignment.Left); bodyStyle.BorderPen = new PdfPen(whiteBrush, 0); table.Style.DefaultStyle = bodyStyle; table.DataSource = GetProductReport(_hostingEnvironment.WebRootPath); table.Columns[0].Width = 90; table.Columns[1].Width = 160; table.Columns[3].Width = 100; table.Columns[4].Width = 65; table.Style.CellPadding = 3; table.BeginCellLayout += table_BeginCellLayout; PdfLightTableLayoutResult result = table.Draw(interactivePage, new RectangleF(50, 240, 500, 140)); g.DrawString("Grand Total:", new PdfStandardFont(PdfFontFamily.Helvetica, 12), new PdfSolidBrush(Syncfusion.Drawing.Color.FromArgb(255, 255, 167, 73)), new PointF(result.Bounds.Right - 150, result.Bounds.Bottom)); CreateTextBox(interactivePage, "GrandTotal", "Grand Total", new RectangleF(result.Bounds.Width - 15, result.Bounds.Bottom - 2, 66, 18), true, ""); //Send to Server PdfButtonField sendButton = new PdfButtonField(interactivePage, "OrderOnline"); sendButton.Bounds = new RectangleF(200, result.Bounds.Bottom + 70, 80, 25); sendButton.BorderColor = white; sendButton.BackColor = maroonColor; sendButton.ForeColor = white; sendButton.Text = "Order Online"; PdfSubmitAction submitAction = new PdfSubmitAction("http://stevex.net/dump.php"); submitAction.DataFormat = SubmitDataFormat.Html; sendButton.Actions.MouseUp = submitAction; document.Form.Fields.Add(sendButton); //Order by Mail PdfButtonField sendMail = new PdfButtonField(interactivePage, "sendMail"); sendMail.Bounds = new RectangleF(300, result.Bounds.Bottom + 70, 80, 25); sendMail.Text = "Order By Mail"; sendMail.BorderColor = white; sendMail.BackColor = maroonColor; sendMail.ForeColor = white; // Create a javascript action. PdfJavaScriptAction javaAction = new PdfJavaScriptAction("address = app.response(\"Enter an e-mail address.\",\"SEND E-MAIL\",\"\");" + "var aSubmitFields = [];" + "for( var i = 0 ; i < this.numFields; i++){" + "aSubmitFields[i] = this.getNthFieldName(i);" + "}" + "if (address){ cmdLine = \"mailto:\" + address;this.submitForm(cmdLine,true,false,aSubmitFields);}"); sendMail.Actions.MouseUp = javaAction; document.Form.Fields.Add(sendMail); //Print PdfButtonField printButton = new PdfButtonField(interactivePage, "print"); printButton.Bounds = new RectangleF(400, result.Bounds.Bottom + 70, 80, 25); printButton.BorderColor = white; printButton.BackColor = maroonColor; printButton.ForeColor = white; printButton.Text = "Print"; printButton.Actions.MouseUp = new PdfJavaScriptAction("this.print (true); "); document.Form.Fields.Add(printButton); file = new FileStream(dataPath + "Product Catalog.pdf", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); PdfAttachment attachment = new PdfAttachment("Product Catalog.pdf", file); attachment.ModificationDate = DateTime.Now; attachment.Description = "Specification"; document.Attachments.Add(attachment); //Open Specification PdfButtonField openSpecificationButton = new PdfButtonField(interactivePage, "openSpecification"); openSpecificationButton.Bounds = new RectangleF(50, result.Bounds.Bottom + 20, 87, 15); openSpecificationButton.TextAlignment = PdfTextAlignment.Left; openSpecificationButton.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 10); openSpecificationButton.BorderStyle = PdfBorderStyle.Underline; openSpecificationButton.BorderColor = orangeColor; openSpecificationButton.BackColor = new PdfColor(255, 255, 255); openSpecificationButton.ForeColor = orangeColor; openSpecificationButton.Text = "Open Specification"; openSpecificationButton.Actions.MouseUp = new PdfJavaScriptAction("this.exportDataObject({ cName: 'Product Catalog.pdf', nLaunch: 2 });"); document.Form.Fields.Add(openSpecificationButton); RectangleF uriAnnotationRectangle = new RectangleF(interactivePage.Graphics.ClientSize.Width - 160, interactivePage.Graphics.ClientSize.Height - 30, 80, 20); PdfTextWebLink linkAnnot = new PdfTextWebLink(); linkAnnot.Url = "http://www.adventure-works.com"; linkAnnot.Text = "http://www.adventure-works.com"; linkAnnot.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 8); linkAnnot.Brush = PdfBrushes.White; linkAnnot.DrawTextWebLink(interactivePage, uriAnnotationRectangle.Location); #endregion #region Footer g.DrawRectangle(purpleBrush, new RectangleF(0, interactivePage.Graphics.ClientSize.Height - 100, interactivePage.Graphics.ClientSize.Width, 100)); g.DrawPie(whitePen, whiteBrush, new RectangleF(-20, interactivePage.Graphics.ClientSize.Height - 250, 700, 200), 0, 180); #endregion //Save the PDF to the MemoryStream MemoryStream ms = new MemoryStream(); document.Save(ms); //If the position is not set to '0' then the PDF will be empty. ms.Position = 0; //Close the PDF document. document.Close(true); //Download the PDF document in the browser. FileStreamResult fileStreamResult = new FileStreamResult(ms, "application/pdf"); fileStreamResult.FileDownloadName = "Interactive features.pdf"; return(fileStreamResult); }
public IActionResult GeneratePDF() { //Creating new PDF document instance PdfDocument document = new PdfDocument(); //Setting margin document.PageSettings.Margins.All = 0; //Adding a new page PdfPage page = document.Pages.Add(); PdfGraphics g = page.Graphics; //Creating font instances PdfFont headerFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 35); PdfFont subHeadingFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 16); //Drawing content onto the PDF g.DrawRectangle(new PdfSolidBrush(gray), new Syncfusion.Drawing.RectangleF(0, 0, page.Graphics.ClientSize.Width, page.Graphics.ClientSize.Height)); g.DrawRectangle(new PdfSolidBrush(black), new Syncfusion.Drawing.RectangleF(0, 0, page.Graphics.ClientSize.Width, 130)); g.DrawRectangle(new PdfSolidBrush(white), new Syncfusion.Drawing.RectangleF(0, 400, page.Graphics.ClientSize.Width, page.Graphics.ClientSize.Height - 450)); g.DrawString("Enterprise", headerFont, new PdfSolidBrush(violet), new Syncfusion.Drawing.PointF(10, 20)); g.DrawRectangle(new PdfSolidBrush(violet), new Syncfusion.Drawing.RectangleF(10, 63, 140, 35)); g.DrawString("Reporting Solutions", subHeadingFont, new PdfSolidBrush(black), new Syncfusion.Drawing.PointF(15, 70)); PdfLayoutResult result = HeaderPoints("Develop cloud-ready reporting applications in as little as 20% of the time.", 15, page); result = HeaderPoints("Proven, reliable platform thousands of users over the past 10 years.", result.Bounds.Bottom + 15, page); result = HeaderPoints("Microsoft Excel, Word, Adobe PDF, RDL display and editing.", result.Bounds.Bottom + 15, page); result = HeaderPoints("Why start from scratch? Rely on our dependable solution frameworks", result.Bounds.Bottom + 15, page); result = BodyContent("Deployment-ready framework tailored to your needs.", result.Bounds.Bottom + 45, page); result = BodyContent("Our architects and developers have years of reporting experience.", result.Bounds.Bottom + 25, page); result = BodyContent("Solutions available for web, desktop, and mobile applications.", result.Bounds.Bottom + 25, page); result = BodyContent("Backed by our end-to-end product maintenance infrastructure.", result.Bounds.Bottom + 25, page); result = BodyContent("The quickest path from concept to delivery.", result.Bounds.Bottom + 25, page); PdfPen redPen = new PdfPen(PdfBrushes.Red, 2); g.DrawLine(redPen, new Syncfusion.Drawing.PointF(40, result.Bounds.Bottom + 92), new Syncfusion.Drawing.PointF(40, result.Bounds.Bottom + 145)); float headerBulletsXposition = 40; PdfTextElement txtElement = new PdfTextElement("The Experts"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); txtElement.Draw(page, new Syncfusion.Drawing.RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 90, 450, 200)); PdfPen violetPen = new PdfPen(PdfBrushes.Violet, 2); g.DrawLine(violetPen, new Syncfusion.Drawing.PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 92), new Syncfusion.Drawing.PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 145)); txtElement = new PdfTextElement("Accurate Estimates"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); result = txtElement.Draw(page, new Syncfusion.Drawing.RectangleF(headerBulletsXposition + 290, result.Bounds.Bottom + 90, 450, 200)); txtElement = new PdfTextElement("A substantial number of .NET reporting applications use our frameworks"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new Syncfusion.Drawing.RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 5, 250, 200)); txtElement = new PdfTextElement("Given our expertise, you can expect estimates to be accurate."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new Syncfusion.Drawing.RectangleF(headerBulletsXposition + 290, result.Bounds.Y, 250, 200)); PdfPen greenPen = new PdfPen(PdfBrushes.Green, 2); g.DrawLine(greenPen, new Syncfusion.Drawing.PointF(40, result.Bounds.Bottom + 32), new Syncfusion.Drawing.PointF(40, result.Bounds.Bottom + 85)); txtElement = new PdfTextElement("Product Licensing"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); txtElement.Draw(page, new Syncfusion.Drawing.RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 30, 450, 200)); PdfPen bluePen = new PdfPen(PdfBrushes.Blue, 2); g.DrawLine(bluePen, new Syncfusion.Drawing.PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 32), new Syncfusion.Drawing.PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 85)); txtElement = new PdfTextElement("About Syncfusion"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); result = txtElement.Draw(page, new Syncfusion.Drawing.RectangleF(headerBulletsXposition + 290, result.Bounds.Bottom + 30, 450, 200)); txtElement = new PdfTextElement("Solution packages can be combined with product licensing for great cost savings."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new Syncfusion.Drawing.RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 5, 250, 200)); txtElement = new PdfTextElement("Syncfusion has more than 7,000 customers including large financial institutions and Fortune 100 companies."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new Syncfusion.Drawing.RectangleF(headerBulletsXposition + 290, result.Bounds.Y, 250, 200)); g.DrawString("All trademarks mentioned belong to their owners.", new PdfStandardFont(PdfFontFamily.TimesRoman, 8, PdfFontStyle.Italic), PdfBrushes.White, new Syncfusion.Drawing.PointF(10, g.ClientSize.Height - 30)); PdfTextWebLink linkAnnot = new PdfTextWebLink(); linkAnnot.Url = "//www.syncfusion.com"; linkAnnot.Text = "www.syncfusion.com"; linkAnnot.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 8, PdfFontStyle.Italic); linkAnnot.Brush = PdfBrushes.White; linkAnnot.DrawTextWebLink(page, new Syncfusion.Drawing.PointF(g.ClientSize.Width - 100, g.ClientSize.Height - 30)); //Saving the PDF to the MemoryStream MemoryStream ms = new MemoryStream(); document.Save(ms); //If the position is not set to '0' then the PDF will be empty. ms.Position = 0; //Download the PDF document in the browser. FileStreamResult fileStreamResult = new FileStreamResult(ms, "application/pdf"); fileStreamResult.FileDownloadName = "Sample.pdf"; return(fileStreamResult); }
void OnButtonClicked(object sender, EventArgs e) { doc = new PdfDocument(); doc.PageSettings.Margins.All = 0; page = doc.Pages.Add(); PdfGraphics g = page.Graphics; PdfFont headerFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 35); PdfFont subHeadingFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 16); g.DrawRectangle(new PdfSolidBrush(gray), new RectangleF(0, 0, page.Graphics.ClientSize.Width, page.Graphics.ClientSize.Height)); g.DrawRectangle(new PdfSolidBrush(black), new RectangleF(0, 0, page.Graphics.ClientSize.Width, 130)); g.DrawRectangle(new PdfSolidBrush(white), new RectangleF(0, 400, page.Graphics.ClientSize.Width, page.Graphics.ClientSize.Height - 450)); g.DrawString("Enterprise", headerFont, new PdfSolidBrush(violet), new PointF(10, 20)); g.DrawRectangle(new PdfSolidBrush(violet), new RectangleF(10, 63, 140, 35)); g.DrawString("Reporting Solutions", subHeadingFont, new PdfSolidBrush(black), new PointF(15, 70)); PdfLayoutResult result = HeaderPoints("Develop cloud-ready reporting applications in as little as 20% of the time.", 15); result = HeaderPoints("Proven, reliable platform thousands of users over the past 10 years.", result.Bounds.Bottom + 15); result = HeaderPoints("Microsoft Excel, Word, Adobe PDF, RDL display and editing.", result.Bounds.Bottom + 15); result = HeaderPoints("Why start from scratch? Rely on our dependable solution frameworks", result.Bounds.Bottom + 15); result = BodyContent("Deployment-ready framework tailored to your needs.", result.Bounds.Bottom + 45); result = BodyContent("Our architects and developers have years of reporting experience.", result.Bounds.Bottom + 25); result = BodyContent("Solutions available for web, desktop, and mobile applications.", result.Bounds.Bottom + 25); result = BodyContent("Backed by our end-to-end product maintenance infrastructure.", result.Bounds.Bottom + 25); result = BodyContent("The quickest path from concept to delivery.", result.Bounds.Bottom + 25); PdfPen redPen = new PdfPen(PdfBrushes.Red, 2); g.DrawLine(redPen, new PointF(40, result.Bounds.Bottom + 92), new PointF(40, result.Bounds.Bottom + 145)); float headerBulletsXposition = 40; PdfTextElement txtElement = new PdfTextElement("The Experts"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); txtElement.Draw(page, new RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 90, 450, 200)); PdfPen violetPen = new PdfPen(PdfBrushes.Violet, 2); g.DrawLine(violetPen, new PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 92), new PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 145)); txtElement = new PdfTextElement("Accurate Estimates"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 290, result.Bounds.Bottom + 90, 450, 200)); txtElement = new PdfTextElement("A substantial number of .NET reporting applications use our frameworks"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 5, 250, 200)); txtElement = new PdfTextElement("Given our expertise, you can expect estimates to be accurate."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 290, result.Bounds.Y, 250, 200)); PdfPen greenPen = new PdfPen(PdfBrushes.Green, 2); g.DrawLine(greenPen, new PointF(40, result.Bounds.Bottom + 32), new PointF(40, result.Bounds.Bottom + 85)); txtElement = new PdfTextElement("Product Licensing"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); txtElement.Draw(page, new RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 30, 450, 200)); PdfPen bluePen = new PdfPen(PdfBrushes.Blue, 2); g.DrawLine(bluePen, new PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 32), new PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 85)); txtElement = new PdfTextElement("About Syncfusion"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 290, result.Bounds.Bottom + 30, 450, 200)); txtElement = new PdfTextElement("Solution packages can be combined with product licensing for great cost savings."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 5, 250, 200)); txtElement = new PdfTextElement("Syncfusion has more than 7,000 customers including large financial institutions and Fortune 100 companies."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 290, result.Bounds.Y, 250, 200)); Stream imgStream = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("SampleBrowser.Samples.PDF.Assets.Reporting-Edition.jpg"); g.DrawImage(PdfImage.FromStream(imgStream), 280, 600, 300, 170); g.DrawString("All trademarks mentioned belong to their owners.", new PdfStandardFont(PdfFontFamily.TimesRoman, 8, PdfFontStyle.Italic), PdfBrushes.White, new PointF(10, g.ClientSize.Height - 30)); PdfTextWebLink linkAnnot = new PdfTextWebLink(); linkAnnot.Url = "http://www.syncfusion.com"; linkAnnot.Text = "www.syncfusion.com"; linkAnnot.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 8, PdfFontStyle.Italic); linkAnnot.Brush = PdfBrushes.White; linkAnnot.DrawTextWebLink(page, new PointF(g.ClientSize.Width - 100, g.ClientSize.Height - 30)); MemoryStream stream = new MemoryStream(); doc.Save(stream); doc.Close(true); if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows) { Xamarin.Forms.DependencyService.Get <ISaveWindowsPhone>().Save("GettingStarted.pdf", "application/pdf", stream); } else { Xamarin.Forms.DependencyService.Get <ISave>().Save("GettingStarted.pdf", "application/pdf", stream); } }
void OnButtonClicked(object sender, EventArgs e) { doc = new PdfDocument(); doc.PageSettings.Margins.All = 0; page = doc.Pages.Add(); PdfGraphics g = page.Graphics; PdfFont headerFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 35); PdfFont subHeadingFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 16); g.DrawRectangle(new PdfSolidBrush(gray), new RectangleF(0, 0, page.Graphics.ClientSize.Width, page.Graphics.ClientSize.Height)); g.DrawRectangle(new PdfSolidBrush(black), new RectangleF(0, 0, page.Graphics.ClientSize.Width, 130)); g.DrawRectangle(new PdfSolidBrush(white), new RectangleF(0, 400, page.Graphics.ClientSize.Width, page.Graphics.ClientSize.Height - 450)); g.DrawString("Syncfusion", headerFont, new PdfSolidBrush(violet), new PointF(10, 20)); g.DrawRectangle(new PdfSolidBrush(violet), new RectangleF(10, 63, 155, 35)); g.DrawString("File Formats", subHeadingFont, new PdfSolidBrush(black), new PointF(45, 70)); PdfLayoutResult result = HeaderPoints("Optimized for usage in a server environment where spread and low memory usage in critical.", 15); result = HeaderPoints("Proven, reliable platform thousands of users over the past 10 years.", result.Bounds.Bottom + 15); result = HeaderPoints("Microsoft Excel, Word, Presentation, PDF and PDF Viewer.", result.Bounds.Bottom + 15); result = HeaderPoints("Why start from scratch? Rely on our dependable solution frameworks.", result.Bounds.Bottom + 15); result = BodyContent("Deployment-ready framework tailored to your needs.", result.Bounds.Bottom + 45); result = BodyContent("Enable your applications to read and write file formats documents easily.", result.Bounds.Bottom + 25); result = BodyContent("Solutions available for web, desktop, and mobile applications.", result.Bounds.Bottom + 25); result = BodyContent("Backed by our end-to-end product maintenance infrastructure.", result.Bounds.Bottom + 25); result = BodyContent("The quickest path from concept to delivery.", result.Bounds.Bottom + 25); PdfPen redPen = new PdfPen(PdfBrushes.Red, 2); g.DrawLine(redPen, new PointF(40, result.Bounds.Bottom + 92), new PointF(40, result.Bounds.Bottom + 145)); float headerBulletsXposition = 40; PdfTextElement txtElement = new PdfTextElement("The Experts"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); txtElement.Draw(page, new RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 90, 450, 200)); PdfPen violetPen = new PdfPen(PdfBrushes.Violet, 2); g.DrawLine(violetPen, new PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 92), new PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 145)); txtElement = new PdfTextElement("Accurate Estimates"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 290, result.Bounds.Bottom + 90, 450, 200)); txtElement = new PdfTextElement("A substantial number of .NET reporting applications use our frameworks."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 5, 250, 200)); txtElement = new PdfTextElement("Given our expertise, you can expect estimates to be accurate."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 290, result.Bounds.Y, 250, 200)); PdfPen greenPen = new PdfPen(PdfBrushes.Green, 2); g.DrawLine(greenPen, new PointF(40, result.Bounds.Bottom + 32), new PointF(40, result.Bounds.Bottom + 85)); txtElement = new PdfTextElement("No-Hassle Licensing"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); txtElement.Draw(page, new RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 30, 450, 200)); PdfPen bluePen = new PdfPen(PdfBrushes.Blue, 2); g.DrawLine(bluePen, new PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 32), new PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 85)); txtElement = new PdfTextElement("About Syncfusion"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 290, result.Bounds.Bottom + 30, 450, 200)); txtElement = new PdfTextElement("No royalties, run time, or server deployment fees means no surprises."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 5, 250, 200)); txtElement = new PdfTextElement("Syncfusion is the enterprise technology partner of choice for software development, delivering a board range of web, mobile, and desktop controls."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 290, result.Bounds.Y, 250, 200)); Stream imgStream = typeof(GettingStartedPDF).GetTypeInfo().Assembly.GetManifestResourceStream("SampleBrowser.Samples.PDF.Assets.Xamarin_bannerEdit.jpg"); g.DrawImage(PdfImage.FromStream(imgStream), 180, 630, 280, 150); g.DrawString("All trademarks mentioned belong to their owners.", new PdfStandardFont(PdfFontFamily.TimesRoman, 8, PdfFontStyle.Italic), PdfBrushes.White, new PointF(10, g.ClientSize.Height - 30)); PdfTextWebLink linkAnnot = new PdfTextWebLink(); linkAnnot.Url = "http://www.syncfusion.com"; linkAnnot.Text = "www.syncfusion.com"; linkAnnot.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 8, PdfFontStyle.Italic); linkAnnot.Brush = PdfBrushes.White; linkAnnot.DrawTextWebLink(page, new PointF(g.ClientSize.Width - 100, g.ClientSize.Height - 30)); MemoryStream stream = new MemoryStream(); doc.Save(stream); doc.Close(true); if (stream != null) { SaveAndroid androidSave = new SaveAndroid(); androidSave.Save("GettingStarted.pdf", "application/pdf", stream, m_context); } }
private void button1_Click(object sender, EventArgs e) { //Create a pdf document. PdfDocument doc = new PdfDocument(); //margin PdfUnitConvertor unitCvtr = new PdfUnitConvertor(); PdfMargins margin = new PdfMargins(); margin.Top = unitCvtr.ConvertUnits(2.54f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point); margin.Bottom = margin.Top; margin.Left = unitCvtr.ConvertUnits(3.17f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point); margin.Right = margin.Left; // Create one page PdfPageBase page = doc.Pages.Add(PdfPageSize.A4, margin); float y = 10; float x = 0; PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial", 12)); String label = "Simple Link: "; PdfStringFormat format = new PdfStringFormat(); format.MeasureTrailingSpaces = true; page.Canvas.DrawString(label, font, PdfBrushes.OrangeRed, 0, y, format); x = font.MeasureString(label, format).Width; PdfTrueTypeFont font1 = new PdfTrueTypeFont(new Font("Arial", 12, FontStyle.Underline)); String url1 = "http://www.e-iceblue.com"; page.Canvas.DrawString(url1, font1, PdfBrushes.Blue, x, y); y = y + font1.MeasureString(url1).Height; label = "Web Link: "; page.Canvas.DrawString(label, font, PdfBrushes.OrangeRed, 0, y, format); x = font.MeasureString(label, format).Width; String text = "e-iceblue"; PdfTextWebLink link2 = new PdfTextWebLink(); link2.Text = text; link2.Url = url1; link2.Font = font1; link2.Brush = PdfBrushes.Blue; link2.DrawTextWebLink(page.Canvas, new PointF(x, y)); y = y + font1.MeasureString(text).Height; label = "URI Annonationa: "; page.Canvas.DrawString(label, font, PdfBrushes.OrangeRed, 0, y, format); x = font.MeasureString(label, format).Width; text = "Google"; PointF location = new PointF(x, y); SizeF size = font1.MeasureString(text); RectangleF linkBounds = new RectangleF(location, size); PdfUriAnnotation link3 = new PdfUriAnnotation(linkBounds); link3.Border = new PdfAnnotationBorder(0); link3.Uri = "http://www.google.com"; (page as PdfNewPage).Annotations.Add(link3); page.Canvas.DrawString(text, font1, PdfBrushes.Blue, x, y); y = y + size.Height; label = "URI Annonationa Action: "; page.Canvas.DrawString(label, font, PdfBrushes.OrangeRed, 0, y, format); x = font.MeasureString(label, format).Width; text = "JavaScript Action (Click Me)"; location = new PointF(x, y); size = font1.MeasureString(text); linkBounds = new RectangleF(location, size); PdfUriAnnotation link4 = new PdfUriAnnotation(linkBounds); link4.Border = new PdfAnnotationBorder(0.75f); link4.Color = Color.LightGray; //script String script = "app.alert({" + " cMsg: \"Hello.\"," + " nIcon: 3," + " cTitle: \"JavaScript Action\"" + "});"; PdfJavaScriptAction action = new PdfJavaScriptAction(script); link4.Action = action; (page as PdfNewPage).Annotations.Add(link4); page.Canvas.DrawString(text, font1, PdfBrushes.Blue, x, y); y = y + size.Height; //Save pdf file. doc.SaveToFile("Link.pdf"); doc.Close(); //Launching the Pdf file. PDFDocumentViewer("Link.pdf"); }
public async Task <FileStreamResult> GenerateBillPDFAsync(Order order) { //Creating new PDF document instance PdfDocument document = new PdfDocument(); //Setting margins document.PageSettings.Margins.All = 0; //Adding a new page PdfPage page = document.Pages.Add(); PdfGraphics graphics = page.Graphics; //Creating font instances PdfFont headerFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 35); PdfFont subHeadingFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 16); //Drawing content onto the PDF graphics.DrawRectangle(new PdfSolidBrush(aliceBlue), new Rectangle(0, 0, (int)page.Graphics.ClientSize.Width, (int)page.Graphics.ClientSize.Height)); graphics.DrawRectangle(new PdfSolidBrush(blue), new Rectangle(0, 0, (int)page.Graphics.ClientSize.Width, 100)); graphics.DrawString("RicardoLourencoWebStore", headerFont, new PdfSolidBrush(aliceBlue), new PointF(10, 20)); PdfLayoutResult result = HeaderPoints("To:", 130, page); result = HeaderPoints($"Name: {order.User.FullName}", result.Bounds.Bottom + 10, page); result = HeaderPoints($"Address: {order.User.Address}", result.Bounds.Bottom + 10, page); result = BodyContent("Order info:", result.Bounds.Bottom + 25, page); result = BodyContent($"Serial number: {order.Id}", result.Bounds.Bottom + 10, page); result = BodyContent("Invoice info:", result.Bounds.Bottom + 45, page); Product product; foreach (var orderDetail in order.Items) { product = await _context.Products.FindAsync(orderDetail.ProductId); result = BodyContent($"Product name: {orderDetail.Product.Name}", result.Bounds.Bottom + 30, page); result = BodyContent($"Quantity: {orderDetail.Quantity}", result.Bounds.Bottom + 10, page); result = BodyContent($"Price: {orderDetail.Value}", result.Bounds.Bottom + 10, page); } graphics.DrawString("All trademarks mentioned belong to their owners.", new PdfStandardFont(PdfFontFamily.TimesRoman, 8, PdfFontStyle.Italic), PdfBrushes.White, new PointF(10, graphics.ClientSize.Height - 30)); PdfTextWebLink linkAnnot = new PdfTextWebLink(); linkAnnot.Url = "//www.syncfusion.com"; linkAnnot.Text = "www.syncfusion.com"; linkAnnot.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 8, PdfFontStyle.Italic); linkAnnot.Brush = PdfBrushes.White; linkAnnot.DrawTextWebLink(page, new PointF(graphics.ClientSize.Width - 100, graphics.ClientSize.Height - 30)); //Saving the PDF to the MemoryStream MemoryStream ms = new MemoryStream(); document.Save(ms); //If the position is not set to '0' then the PDF will be empty. ms.Position = 0; //Download the PDF document in the browser. FileStreamResult fileStreamResult = new FileStreamResult(ms, "application/pdf") { FileDownloadName = $"Invoice_{order.Id}_{DateTime.UtcNow}.pdf" }; return(fileStreamResult); }
private void button1_Click(object sender, EventArgs e) { //Create a pdf document. PdfDocument doc = new PdfDocument(); //Set margins PdfUnitConvertor unitCvtr = new PdfUnitConvertor(); PdfMargins margin = new PdfMargins(); margin.Top = unitCvtr.ConvertUnits(2.54f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point); margin.Bottom = margin.Top; margin.Left = unitCvtr.ConvertUnits(3.17f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point); margin.Right = margin.Left; //Create one page PdfPageBase page = doc.Pages.Add(PdfPageSize.A4, margin); float y = 100; float x = 10; PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Lucida Sans Unicode", 14)); String label = "Simple Text Link: "; PdfStringFormat format = new PdfStringFormat(); format.MeasureTrailingSpaces = true; page.Canvas.DrawString(label, font, PdfBrushes.Orange, 0, y, format); x = font.MeasureString(label, format).Width; PdfTrueTypeFont font1 = new PdfTrueTypeFont(new Font("Lucida Sans Unicode", 14, FontStyle.Underline)); String url1 = "http://www.e-iceblue.com"; page.Canvas.DrawString(url1, font1, PdfBrushes.CadetBlue, x, y); y = y + font1.MeasureString(url1).Height + 25; label = "Web Link: "; page.Canvas.DrawString(label, font, PdfBrushes.Orange, 0, y, format); x = font.MeasureString(label, format).Width; String text = "E-iceblue home"; PdfTextWebLink link2 = new PdfTextWebLink(); link2.Text = text; link2.Url = url1; link2.Font = font1; link2.Brush = PdfBrushes.CadetBlue; link2.DrawTextWebLink(page.Canvas, new PointF(x, y)); y = y + font1.MeasureString(text).Height + 30; label = "URI Annonation: "; page.Canvas.DrawString(label, font, PdfBrushes.Orange, 0, y, format); x = font.MeasureString(label, format).Width; text = "Google"; PointF location = new PointF(x, y); SizeF size = font1.MeasureString(text); RectangleF linkBounds = new RectangleF(location, size); PdfUriAnnotation link3 = new PdfUriAnnotation(linkBounds); link3.Border = new PdfAnnotationBorder(0); link3.Uri = "http://www.google.com"; (page as PdfNewPage).Annotations.Add(link3); page.Canvas.DrawString(text, font1, PdfBrushes.CadetBlue, x, y); y = y + size.Height + 30; label = "URI Annonation Action: "; page.Canvas.DrawString(label, font, PdfBrushes.Orange, 0, y, format); x = font.MeasureString(label, format).Width; text = "JavaScript Action (Click Me)"; location = new PointF(x - 2, y - 2); size = font1.MeasureString(text); size = new SizeF(size.Width + 5, size.Height + 5); linkBounds = new RectangleF(location, size); PdfUriAnnotation link4 = new PdfUriAnnotation(linkBounds); link4.Border = new PdfAnnotationBorder(0.75f); link4.Color = Color.CadetBlue; //Script String script = "app.alert({" + " cMsg: \"Hello.\"," + " nIcon: 3," + " cTitle: \"JavaScript Action\"" + "});"; PdfJavaScriptAction action = new PdfJavaScriptAction(script); link4.Action = action; (page as PdfNewPage).Annotations.Add(link4); page.Canvas.DrawString(text, font1, PdfBrushes.CadetBlue, x, y); y = y + size.Height + 30; label = "Need Help: "; page.Canvas.DrawString(label, font, PdfBrushes.Orange, 0, y, format); x = font.MeasureString(label, format).Width; text = "Go to forum to ask questions"; link2 = new PdfTextWebLink(); link2.Text = text; link2.Url = "https://www.e-iceblue.com/forum/components-f5.html"; link2.Font = font1; link2.Brush = PdfBrushes.CadetBlue; link2.DrawTextWebLink(page.Canvas, new PointF(x, y)); y = y + font1.MeasureString(text).Height + 30; label = "Contct us: "; page.Canvas.DrawString(label, font, PdfBrushes.Orange, 0, y, format); x = font.MeasureString(label, format).Width; text = "Send an email"; link2 = new PdfTextWebLink(); link2.Text = text; link2.Url = "mailto:[email protected]"; link2.Font = font1; link2.Brush = PdfBrushes.CadetBlue; link2.DrawTextWebLink(page.Canvas, new PointF(x, y)); y = y + font1.MeasureString(text).Height + 30; //Save pdf file. doc.SaveToFile("Link.pdf"); doc.Close(); //Launch the file. PDFDocumentViewer("Link.pdf"); }
public async Task <FileStreamResult> GenerateBillPDFAsync(Bill bill) { var waterMeter = await GetWaterMeterWithUserAsync(bill.WaterMeterId); //Creating new PDF document instance PdfDocument document = new PdfDocument(); //Setting margins document.PageSettings.Margins.All = 0; //Adding a new page PdfPage page = document.Pages.Add(); PdfGraphics graphics = page.Graphics; //Creating font instances PdfFont headerFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 35); PdfFont subHeadingFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 16); //Drawing content onto the PDF graphics.DrawRectangle(new PdfSolidBrush(aliceBlue), new Rectangle(0, 0, (int)page.Graphics.ClientSize.Width, (int)page.Graphics.ClientSize.Height)); graphics.DrawRectangle(new PdfSolidBrush(blue), new Rectangle(0, 0, (int)page.Graphics.ClientSize.Width, 100)); graphics.DrawString("Ricardo's Water Company", headerFont, new PdfSolidBrush(aliceBlue), new PointF(10, 20)); PdfLayoutResult result = HeaderPoints("To:", 130, page); result = HeaderPoints($"Name: {waterMeter.User.FullName}", result.Bounds.Bottom + 10, page); result = HeaderPoints($"Address: {waterMeter.User.Address}", result.Bounds.Bottom + 10, page); result = HeaderPoints($"TIN: {waterMeter.User.TIN}", result.Bounds.Bottom + 10, page); result = BodyContent("Water meter info:", result.Bounds.Bottom + 25, page); result = BodyContent($"Serial number: {waterMeter.Id}", result.Bounds.Bottom + 10, page); result = BodyContent($"Address: {waterMeter.Address}", result.Bounds.Bottom + 10, page); result = BodyContent($"Zip-code: {waterMeter.ZipCode}", result.Bounds.Bottom + 10, page); result = BodyContent($"Total consumption: {waterMeter.TotalConsumption} m³", result.Bounds.Bottom + 10, page); result = BodyContent("Invoice info:", result.Bounds.Bottom + 45, page); result = BodyContent($"Consumption: {bill.Consumption} m³", result.Bounds.Bottom + 10, page); result = BodyContent($"Month/Year: {bill.MonthYear:MMMM/yyyy}", result.Bounds.Bottom + 10, page); result = BodyContent($"Price: {bill.FinalValue:C2} €", result.Bounds.Bottom + 10, page); graphics.DrawString("All trademarks mentioned belong to their owners.", new PdfStandardFont(PdfFontFamily.TimesRoman, 8, PdfFontStyle.Italic), PdfBrushes.White, new PointF(10, graphics.ClientSize.Height - 30)); PdfTextWebLink linkAnnot = new PdfTextWebLink(); linkAnnot.Url = "//www.syncfusion.com"; linkAnnot.Text = "www.syncfusion.com"; linkAnnot.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 8, PdfFontStyle.Italic); linkAnnot.Brush = PdfBrushes.White; linkAnnot.DrawTextWebLink(page, new PointF(graphics.ClientSize.Width - 100, graphics.ClientSize.Height - 30)); //Saving the PDF to the MemoryStream MemoryStream ms = new MemoryStream(); document.Save(ms); //If the position is not set to '0' then the PDF will be empty. ms.Position = 0; //Download the PDF document in the browser. FileStreamResult fileStreamResult = new FileStreamResult(ms, "application/pdf") { FileDownloadName = $"Invoice_{waterMeter.Id}_{bill.Id}_{DateTime.UtcNow}.pdf" }; return(fileStreamResult); }
void OnButtonClicked(object sender, EventArgs e) { doc = new PdfDocument(); doc.PageSettings.Margins.All = 0; page = doc.Pages.Add(); PdfGraphics g = page.Graphics; PdfFont headerFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 35); PdfFont subHeadingFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 16); g.DrawRectangle(new PdfSolidBrush(gray), new RectangleF(0, 0, page.Graphics.ClientSize.Width, page.Graphics.ClientSize.Height)); g.DrawRectangle(new PdfSolidBrush(black), new RectangleF(0, 0, page.Graphics.ClientSize.Width, 130)); g.DrawRectangle(new PdfSolidBrush(white), new RectangleF(0, 400, page.Graphics.ClientSize.Width, page.Graphics.ClientSize.Height - 450)); g.DrawString("Enterprise", headerFont, new PdfSolidBrush(violet), new PointF(10, 20)); g.DrawRectangle(new PdfSolidBrush(violet), new RectangleF(10, 63, 140, 35)); g.DrawString("Reporting Solutions", subHeadingFont, new PdfSolidBrush(black), new PointF(15, 70)); PdfLayoutResult result = HeaderPoints("Develop cloud-ready reporting applications in as little as 20% of the time.", 15); result = HeaderPoints("Proven, reliable platform thousands of users over the past 10 years.", result.Bounds.Bottom + 15); result = HeaderPoints("Microsoft Excel, Word, Adobe PDF, RDL display and editing.", result.Bounds.Bottom + 15); result = HeaderPoints("Why start from scratch? Rely on our dependable solution frameworks", result.Bounds.Bottom + 15); result = BodyContent("Deployment-ready framework tailored to your needs.", result.Bounds.Bottom + 45); result = BodyContent("Our architects and developers have years of reporting experience.", result.Bounds.Bottom + 25); result = BodyContent("Solutions available for web, desktop, and mobile applications.", result.Bounds.Bottom + 25); result = BodyContent("Backed by our end-to-end product maintenance infrastructure.", result.Bounds.Bottom + 25); result = BodyContent("The quickest path from concept to delivery.", result.Bounds.Bottom + 25); PdfPen redPen = new PdfPen(PdfBrushes.Red, 2); g.DrawLine(redPen, new PointF(40, result.Bounds.Bottom + 92), new PointF(40, result.Bounds.Bottom + 145)); float headerBulletsXposition = 40; PdfTextElement txtElement = new PdfTextElement("The Experts"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); txtElement.Draw(page, new RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 90, 450, 200)); PdfPen violetPen = new PdfPen(PdfBrushes.Violet, 2); g.DrawLine(violetPen, new PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 92), new PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 145)); txtElement = new PdfTextElement("Accurate Estimates"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 290, result.Bounds.Bottom + 90, 450, 200)); txtElement = new PdfTextElement("A substantial number of .NET reporting applications use our frameworks"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 5, 250, 200)); txtElement = new PdfTextElement("Given our expertise, you can expect estimates to be accurate."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 290, result.Bounds.Y, 250, 200)); PdfPen greenPen = new PdfPen(PdfBrushes.Green, 2); g.DrawLine(greenPen, new PointF(40, result.Bounds.Bottom + 32), new PointF(40, result.Bounds.Bottom + 85)); txtElement = new PdfTextElement("Product Licensing"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); txtElement.Draw(page, new RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 30, 450, 200)); PdfPen bluePen = new PdfPen(PdfBrushes.Blue, 2); g.DrawLine(bluePen, new PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 32), new PointF(headerBulletsXposition + 280, result.Bounds.Bottom + 85)); txtElement = new PdfTextElement("About Syncfusion"); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 20); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 290, result.Bounds.Bottom + 30, 450, 200)); txtElement = new PdfTextElement("Solution packages can be combined with product licensing for great cost savings."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 5, result.Bounds.Bottom + 5, 250, 200)); txtElement = new PdfTextElement("Syncfusion has more than 7,000 customers including large financial institutions and Fortune 100 companies."); txtElement.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 11, PdfFontStyle.Regular); result = txtElement.Draw(page, new RectangleF(headerBulletsXposition + 290, result.Bounds.Y, 250, 200)); Stream imgStream = typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("SampleBrowser.Samples.PDF.Assets.Reporting-Edition.jpg"); g.DrawImage(PdfImage.FromStream(imgStream), 280, 600, 300, 170); g.DrawString("All trademarks mentioned belong to their owners.", new PdfStandardFont(PdfFontFamily.TimesRoman, 8, PdfFontStyle.Italic), PdfBrushes.White, new PointF(10, g.ClientSize.Height - 30)); PdfTextWebLink linkAnnot = new PdfTextWebLink(); linkAnnot.Url = "http://www.syncfusion.com"; linkAnnot.Text = "www.syncfusion.com"; linkAnnot.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 8, PdfFontStyle.Italic); linkAnnot.Brush = PdfBrushes.White; linkAnnot.DrawTextWebLink(page, new PointF(g.ClientSize.Width - 100, g.ClientSize.Height - 30)); MemoryStream stream = new MemoryStream(); doc.Save(stream); doc.Close(true); if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows) Xamarin.Forms.DependencyService.Get<ISaveWindowsPhone>().Save("GettingStarted.pdf", "application/pdf", stream); else Xamarin.Forms.DependencyService.Get<ISave>().Save("GettingStarted.pdf", "application/pdf", stream); }