public SetPageMode ( HPdfPageMode mode ) : void | ||
mode | HPdfPageMode | |
Résultat | void |
public static void Main() { Console.WriteLine("libhpdf-" + HPdfDoc.HPdfGetVersion()); try { HPdfDoc pdf = new HPdfDoc(); pdf.SetCompressionMode(HPdfDoc.HPDF_COMP_ALL); /* create default-font */ HPdfFont font = pdf.GetFont("Helvetica", null); pdf.SetPageMode(HPdfPageMode.HPDF_PAGE_MODE_USE_OUTLINE); /* add a new page object. */ /* Add 3 pages to the document. */ HPdfPage page0 = pdf.AddPage(); page0.SetFontAndSize (font, 30); PrintPage(page0, 1); HPdfPage page1 = pdf.AddPage(); page1.SetFontAndSize(font, 30); PrintPage(page1, 2); HPdfPage page2 = pdf.AddPage(); page2.SetFontAndSize(font, 30); PrintPage(page2, 3); /* create outline root. */ HPdfOutline root = pdf.CreateOutline(null, "OutlineRoot", null); root.SetOpened (true); HPdfOutline outline0 = pdf.CreateOutline(root, "page1", null); HPdfOutline outline1 = pdf.CreateOutline(root, "page2", null); /* create outline with test which is ISO8859-2 encoding */ HPdfOutline outline2 = pdf.CreateOutline(root, "ISO8859-2 text гдежзий", pdf.GetEncoder("ISO8859-2")); /* create destination objects on each pages * and link it to outline items. */ HPdfDestination dst = page0.CreateDestination(); dst.SetXYZ(0, page0.GetHeight(), 1); outline0.SetDestination(dst); dst = page1.CreateDestination(); dst.SetXYZ(0, page1.GetHeight(), 1); outline1.SetDestination(dst); dst = page2.CreateDestination(); dst.SetXYZ(0, page2.GetHeight(), 1); outline2.SetDestination(dst); /* save the document to a file */ pdf.SaveToFile("OutlineDemo.pdf"); } catch (Exception e) { Console.Error.WriteLine(e.Message); } }
public static void Main() { Console.WriteLine("libhpdf-" + HPdfDoc.HPdfGetVersion()); try { const int PAGE_HEIGHT = 210; string samp_text = "アメンボ赤いなあいうえお。浮き藻に小エビもおよいでる。"; HPdfFont[] detail_font = new HPdfFont[16]; HPdfDoc pdf = new HPdfDoc(); /*declaration for using Japanese font, encoding. */ pdf.UseJPEncodings(); pdf.UseJPFonts(); detail_font[0] = pdf.GetFont("MS-Mincyo", "90ms-RKSJ-H"); detail_font[1] = pdf.GetFont("MS-Mincyo,Bold", "90ms-RKSJ-H"); detail_font[2] = pdf.GetFont("MS-Mincyo,Italic", "90ms-RKSJ-H"); detail_font[3] = pdf.GetFont("MS-Mincyo,BoldItalic", "90ms-RKSJ-H"); detail_font[4] = pdf.GetFont("MS-PMincyo", "90msp-RKSJ-H"); detail_font[5] = pdf.GetFont("MS-PMincyo,Bold", "90msp-RKSJ-H"); detail_font[6] = pdf.GetFont("MS-PMincyo,Italic", "90msp-RKSJ-H"); detail_font[7] = pdf.GetFont("MS-PMincyo,BoldItalic", "90msp-RKSJ-H"); detail_font[8] = pdf.GetFont("MS-Gothic", "90ms-RKSJ-H"); detail_font[9] = pdf.GetFont("MS-Gothic,Bold", "90ms-RKSJ-H"); detail_font[10] = pdf.GetFont("MS-Gothic,Italic", "90ms-RKSJ-H"); detail_font[11] = pdf.GetFont("MS-Gothic,BoldItalic", "90ms-RKSJ-H"); detail_font[12] = pdf.GetFont("MS-PGothic", "90msp-RKSJ-H"); detail_font[13] = pdf.GetFont("MS-PGothic,Bold", "90msp-RKSJ-H"); detail_font[14] = pdf.GetFont("MS-PGothic,Italic", "90msp-RKSJ-H"); detail_font[15] = pdf.GetFont("MS-PGothic,BoldItalic", "90msp-RKSJ-H"); /*configure pdf-document to be compressed. */ pdf.SetCompressionMode(HPdfDoc.HPDF_COMP_ALL); /*Set page mode to use outlines. */ pdf.SetPageMode(HPdfPageMode.HPDF_PAGE_MODE_USE_OUTLINE); /*create outline root. */ HPdfOutline root = pdf.CreateOutline(null, "JP font demo", null); root.SetOpened (true); for (int i = 0; i <= 15; i++) { float x_pos; /*add a new page object. */ HPdfPage page = pdf.AddPage(); /*create outline entry */ HPdfOutline outline = pdf.CreateOutline(root, detail_font[i].GetFontName(), null); HPdfDestination dst = page.CreateDestination(); outline.SetDestination(dst); HPdfFont title_font = pdf.GetFont("Helvetica", null); page.SetFontAndSize(title_font, 10); page.BeginText(); /*move the position of the text to top of the page. */ page.MoveTextPos(10, 190); page.ShowText(detail_font[i].GetFontName()); page.SetFontAndSize(detail_font[i], 15); page.MoveTextPos(10, -20); page.ShowText("abcdefghijklmnopqrstuvwxyz"); page.MoveTextPos(0, -20); page.ShowText("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); page.MoveTextPos(0, -20); page.ShowText("1234567890"); page.MoveTextPos(0, -20); page.SetFontAndSize(detail_font[i], 10); page.ShowText(samp_text); page.MoveTextPos(0, -18); page.SetFontAndSize(detail_font[i], 16); page.ShowText(samp_text); page.MoveTextPos(0, -27); page.SetFontAndSize(detail_font[i], 23); page.ShowText(samp_text); page.MoveTextPos(0, -36); page.SetFontAndSize(detail_font[i], 30); page.ShowText(samp_text); HPdfPoint p = page.GetCurrentTextPos(); /*finish to print text. */ page.EndText(); page.SetLineWidth(0.5f); x_pos = 20; for (int j = 0; j <= samp_text.Length / 2; j++) { page.MoveTo(x_pos, p.y - 10); page.LineTo(x_pos, p.y - 12); page.Stroke(); x_pos = x_pos + 30; } page.SetWidth(p.x + 20); page.SetHeight(PAGE_HEIGHT); page.MoveTo(10, PAGE_HEIGHT - 25); page.LineTo(p.x + 10, PAGE_HEIGHT - 25); page.Stroke(); page.MoveTo(10, PAGE_HEIGHT - 85); page.LineTo(p.x + 10, PAGE_HEIGHT - 85); page.Stroke(); page.MoveTo(10, p.y - 12); page.LineTo(p.x + 10, p.y - 12); page.Stroke(); } pdf.SaveToFile("JPFontDemo.pdf"); } catch (Exception e) { Console.Error.WriteLine(e.Message); } }
public static void Main() { Console.WriteLine("libhpdf-" + HPdfDoc.HPdfGetVersion()); rand = new Random(); try { HPdfDoc pdf = new HPdfDoc(); HPdfPage[] page = new HPdfPage[17]; /* create default-font */ HPdfFont font = pdf.GetFont ("Courier", null); /* Add 17 pages to the document. */ page[0] = pdf.AddPage(); page[1] = pdf.AddPage(); page[2] = pdf.AddPage(); page[3] = pdf.AddPage(); page[4] = pdf.AddPage(); page[5] = pdf.AddPage(); page[6] = pdf.AddPage(); page[7] = pdf.AddPage(); page[8] = pdf.AddPage(); page[9] = pdf.AddPage(); page[10] = pdf.AddPage(); page[11] = pdf.AddPage(); page[12] = pdf.AddPage(); page[13] = pdf.AddPage(); page[14] = pdf.AddPage(); page[15] = pdf.AddPage(); page[16] = pdf.AddPage(); PrintPage(page[0], "HPDF_TS_WIPE_RIGHT", font, HPdfTransitionStyle.HPDF_TS_WIPE_RIGHT, null, page[1]); PrintPage(page[1], "HPDF_TS_WIPE_UP", font, HPdfTransitionStyle.HPDF_TS_WIPE_UP, page[0], page[2]); PrintPage(page[2], "HPDF_TS_WIPE_LEFT", font, HPdfTransitionStyle.HPDF_TS_WIPE_LEFT, page[1], page[3]); PrintPage(page[3], "HPDF_TS_WIPE_DOWN", font, HPdfTransitionStyle.HPDF_TS_WIPE_DOWN, page[2], page[4]); PrintPage(page[4], "HPDF_TS_BARN_DOORS_HORIZONTAL_OUT", font, HPdfTransitionStyle.HPDF_TS_BARN_DOORS_HORIZONTAL_OUT, page[3], page[5]); PrintPage(page[5], "HPDF_TS_BARN_DOORS_HORIZONTAL_IN", font, HPdfTransitionStyle.HPDF_TS_BARN_DOORS_HORIZONTAL_IN, page[4], page[6]); PrintPage(page[6], "HPDF_TS_BARN_DOORS_VERTICAL_OUT", font, HPdfTransitionStyle.HPDF_TS_BARN_DOORS_VERTICAL_OUT, page[5], page[7]); PrintPage(page[7], "HPDF_TS_BARN_DOORS_VERTICAL_IN", font, HPdfTransitionStyle.HPDF_TS_BARN_DOORS_VERTICAL_IN, page[6], page[8]); PrintPage(page[8], "HPDF_TS_BOX_OUT", font, HPdfTransitionStyle.HPDF_TS_BOX_OUT, page[7], page[9]); PrintPage(page[9], "HPDF_TS_BOX_IN", font, HPdfTransitionStyle.HPDF_TS_BOX_IN, page[8], page[10]); PrintPage(page[10], "HPDF_TS_BLINDS_HORIZONTAL", font, HPdfTransitionStyle.HPDF_TS_BLINDS_HORIZONTAL, page[9], page[11]); PrintPage(page[11], "HPDF_TS_BLINDS_VERTICAL", font, HPdfTransitionStyle.HPDF_TS_BLINDS_VERTICAL, page[10], page[12]); PrintPage(page[12], "HPDF_TS_DISSOLVE", font, HPdfTransitionStyle.HPDF_TS_DISSOLVE, page[11], page[13]); PrintPage(page[13], "HPDF_TS_GLITTER_RIGHT", font, HPdfTransitionStyle.HPDF_TS_GLITTER_RIGHT, page[12], page[14]); PrintPage(page[14], "HPDF_TS_GLITTER_DOWN", font, HPdfTransitionStyle.HPDF_TS_GLITTER_DOWN, page[13], page[15]); PrintPage(page[15], "HPDF_TS_GLITTER_TOP_LEFT_TO_BOTTOM_RIGHT", font, HPdfTransitionStyle.HPDF_TS_GLITTER_TOP_LEFT_TO_BOTTOM_RIGHT, page[14], page[16]); PrintPage(page[16], "HPDF_TS_REPLACE", font, HPdfTransitionStyle.HPDF_TS_REPLACE, page[15], null); pdf.SetPageMode (HPdfPageMode.HPDF_PAGE_MODE_FULL_SCREEN); /* save the document to a file */ pdf.SaveToFile("SlideShowDemo.pdf"); } catch (Exception e) { Console.Error.WriteLine(e.Message); } }