private void GetLayoutTemplates(PaperSize paperSize) { string path = _folderService.GetBookTemplateFolder(paperSize.ToString()); Layouts = new ObservableCollection <BookLayout>(_bookLayoutService.LoadLayoutsFromDirectory(path)); BitmapSource image = new BitmapImage(new Uri("pack://application:,,,/Resources/Img/MemoriesWhite.jpg")); Layouts.Insert(0, new BookLayout { Name = "빈 책", PreviewSource = ByteArrayToImageSourceConverter.SourceToByteArray(image) }); }
// a4 210mm x 297mm // inchs 8.2677 in x 11.6929 //internal static RGSizeF GetA4Pixel() //{ // RGFloat dpi = PlatformUtility.GetDPI(); // return new RGSizeF(dpi * 8.2677f, dpi * 11.6929f); //} internal static RGSizeF GetPaperSizeValue(PaperSize psize) { RGSizeF size; if (PaperSizesInch.TryGetValue(psize.ToString(), out size)) { return(size); //return new RGSizeF(MeasureToolkit.CMToInch(size.Width / 10f), MeasureToolkit.CMToInch(size.Height / 10f)); } else { //RGFloat dpi = PlatformUtility.GetDPI(); // return default Letter return(new RGSizeF(8.5f, 11f)); } }
/// <summary> /// Generates the arguments string to pass to WKHtmlToPDF /// </summary> /// <param name="inputFile">The name of the source file (html)</param> /// <param name="outputFile">The name of the output PDF file</param> /// <returns>A string that can be passed as arguments, reflecting the specified options.</returns> public string WKHtmlToPDFArguments(string inputFile, string outputFile) { if (inputFile == null) { throw new ArgumentNullException("inputFile"); } if (outputFile == null) { throw new ArgumentNullException("outputFile"); } return(String.Format(CultureInfo.InvariantCulture, "--orientation {0} --print-media-type --disable-javascript --footer-font-size 8 -s {1} {2} {3} {4} {5} {6} {7} {8} {9}", Orientation.ToString(), PaperSize.ToString(), TopMargin.HasValue ? String.Format(CultureInfo.InvariantCulture, "--margin-top {0}", TopMargin.Value) : string.Empty, BottomMargin.HasValue ? String.Format(CultureInfo.InvariantCulture, "--margin-bottom {0}", BottomMargin.Value) : string.Empty, LeftMargin.HasValue ? String.Format(CultureInfo.InvariantCulture, "--margin-left {0}", LeftMargin.Value) : string.Empty, RightMargin.HasValue ? String.Format(CultureInfo.InvariantCulture, "--margin-right {0}", RightMargin.Value) : string.Empty, String.IsNullOrEmpty(FooterLeft) ? string.Empty : String.Format(CultureInfo.InvariantCulture, "--footer-left \"{0}\"", FooterLeft), String.IsNullOrEmpty(FooterRight) ? string.Empty : String.Format(CultureInfo.InvariantCulture, "--footer-right \"{0}\"", FooterRight), inputFile, outputFile)); }
public void ToString_Invoke_ReturnsExpected(PaperSize size, string expected) { Assert.Equal(expected, size.ToString()); }
private void PrintPreview_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawString(pageSize.ToString(), new Font("Tahoma", 10), Brushes.AliceBlue, 3, 3); }