private void ApplyDocumentSettings( Document document, string title, string subject, string keywords ) { if (title == null) { return; } // Viewer preferences. ViewerPreferences view = new ViewerPreferences(document); // Instantiates viewer preferences inside the document context. document.ViewerPreferences = view; // Assigns the viewer preferences object to the viewer preferences function. view.DisplayDocTitle = true; // Document metadata. Information info = document.Information; info.Clear(); info.Author = "Stefano Chizzolini"; info.CreationDate = DateTime.Now; info.Creator = GetType().FullName; info.Title = "PDF Clown - " + title + " sample"; info.Subject = "Sample about " + subject + " using PDF Clown"; info.Keywords = keywords; }
/// <summary> /// Apply document properties like title etc /// </summary> /// <param name="document"></param> /// <param name="title"></param> /// <param name="subject"></param> /// <param name="keywords"></param> private void ApplyDocumentSettings(Document document, string title, string subject, string keywords ) { if (title == null) { return; } // Viewer preferences. ViewerPreferences view = new ViewerPreferences(document); // Instantiates viewer preferences inside the document context. document.ViewerPreferences = view; // Assigns the viewer preferences object to the viewer preferences function. view.DisplayDocTitle = true; // Document metadata. Information info = document.Information; info.Clear(); info.Author = AUTHOR; info.CreationDate = DateTime.Now; info.Creator = GetType().FullName; info.Title = title; info.Subject = subject; info.Keywords = keywords; }
private void loadViewerPreferences() { PDFDictionary viewerPreferences = _dictionary["ViewerPreferences"] as PDFDictionary; if (viewerPreferences != null) { _viewerPreferences = new ViewerPreferences(viewerPreferences); } else { _viewerPreferences = new ViewerPreferences(); _dictionary.AddItem("ViewerPreferences", _viewerPreferences.GetDictionary()); } }
public string ViewerPreferencesConverter(ViewerPreferences src, Language lang) => Convert <string>(new ViewerPreferencesConverter(), src, lang);
private void ApplyDocumentSettings( Document document, string title, string subject, string keywords ) { if(title == null) return; // Viewer preferences. ViewerPreferences view = new ViewerPreferences(document); // Instantiates viewer preferences inside the document context. document.ViewerPreferences = view; // Assigns the viewer preferences object to the viewer preferences function. view.DisplayDocTitle = true; // Document metadata. Information info = document.Information; info.Clear(); info.Author = "Stefano Chizzolini"; info.CreationDate = DateTime.Now; info.Creator = GetType().FullName; info.Title = "PDF Clown - " + title + " sample"; info.Subject = "Sample about " + subject + " using PDF Clown"; info.Keywords = keywords; }
private static void SetupFrontPage(Document doc, string title, string subtitle) { if(title == null) title = ""; if(subtitle == null) subtitle = ""; ViewerPreferences vp = new ViewerPreferences(); vp.ZoomFactor = 0.75; doc.ViewerPreferences = vp; Section mainPage = new Section(); mainPage.StartOnNewPage = true; doc.Sections.Add(mainPage); System.Drawing.Bitmap logo = GetOpenSpanLogo(); if(logo != null) { Image i = new Image(logo, true); i.HorizontalAlignment = TallComponents.PDF.Layout.HorizontalAlignment.Center; i.FitPolicy = FitPolicy.Shrink; i.Compression = Compression.Auto; i.KeepAspectRatio = true; i.Actions.Add(new TallComponents.PDF.Layout.Actions.UriAction("www.openspan.com")); double w = (mainPage.PageSize.Width/2) - (i.Width / 2); double h = (mainPage.PageSize.Height/2) - (i.Height / 2); Area a = new Area(w, mainPage.PageSize.Height, i.Width, mainPage.PageSize.Height); a.VerticalAlignment = TallComponents.PDF.Layout.VerticalAlignment.Middle; mainPage.ForegroundAreas.Add(a); a.Paragraphs.Add(i); TextParagraph tp = new TextParagraph(); tp.HorizontalAlignment = TallComponents.PDF.Layout.HorizontalAlignment.Center; Fragment f = new Fragment(); f.Text = title; f.Font = Font.HelveticaBold; f.FontSize = 22; f.Bold = true; tp.Fragments.Add(f); a.Paragraphs.Add(tp); tp = new TextParagraph(); tp.HorizontalAlignment = TallComponents.PDF.Layout.HorizontalAlignment.Center; f = new Fragment(); f.Text = subtitle; f.Bold = true; f.Font = Font.HelveticaBold; f.FontSize = 18; tp.Fragments.Add(f); a.Paragraphs.Add(tp); } }