# # This has been ported by Hiroshi Saito(hiroshi@winpg.jp) # Copyright notice of the original as below. # # # * << Haru Free PDF Library 2.0.0 >> -- slide_show_demo.c # * # * Copyright(c) 1999-2006 Takeshi Kanno # * # * Permission to use, copy, modify, distribute and sell this software # * and its documentation for any purpose is hereby granted without fee, # * provided that the above copyright notice appear in all copies and # * that both that copyright notice and this permission notice appear # * in supporting documentation. # * It is provided "as is" without express or implied warranty. # * # @load "pdf" # ---- # main # ---- BEGIN { fname = "pdf_slide_show.pdf"; width = 800; height = 600; rectN[1] = 680; rectN[2] = 750; rectN[3] = 70; rectN[4] = 50; rectP[1] = 50; rectP[2] = 110; rectP[3] = 70; rectP[4] = 50; r = 0.1; g = 0.5; b = 0.7; pdf = HPDF_New(NULL, NULL); # create default-font font = HPDF_GetFont(pdf, "Helvetica", NULL); # Add pages to the document. # --- Page1 Page1 = HPDF_AddPage(pdf); HPDF_Page_SetWidth(Page1, width); HPDF_Page_SetHeight(Page1, height); HPDF_Page_SetRGBFill(Page1, r, g, b); HPDF_Page_Rectangle(Page1, 0, 0, width, height); HPDF_Page_Fill(Page1); HPDF_Page_SetRGBFill(Page1, 1.0, 1.0, 1.0); HPDF_Page_SetFontAndSize(Page1, font, 30); HPDF_Page_BeginText(Page1); HPDF_Page_SetTextMatrix(Page1, 0.8, 0.0, 0.0, 1.0, 0.0, 0.0); HPDF_Page_TextOut(Page1, 50, 530, "HPDF_TS_WIPE_RIGHT"); HPDF_Page_SetTextMatrix(Page1, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0); HPDF_Page_TextOut(Page1, 55, 300, "Type \"Ctrl+L\" in order to return from full screen mode."); HPDF_Page_EndText(Page1); HPDF_Page_SetSlideShow(Page1, HPDF_TS_WIPE_RIGHT, 5.0, 1.0); # --- Page2 Page2 = HPDF_AddPage(pdf); HPDF_Page_SetWidth(Page2, width); HPDF_Page_SetHeight(Page2, height); HPDF_Page_SetRGBFill(Page2, r + 0.2, g + 0.2, b); HPDF_Page_Rectangle(Page2, 0, 0, width, height); HPDF_Page_Fill(Page2); HPDF_Page_SetRGBFill(Page2, 1.0, 1.0, 1.0); HPDF_Page_SetFontAndSize(Page2, font, 30); HPDF_Page_BeginText(Page2); HPDF_Page_SetTextMatrix(Page2, 0.8, 0.0, 0.0, 1.0, 0.0, 0.0); HPDF_Page_TextOut(Page2, 50, 530, "HPDF_TS_WIPE_UP"); HPDF_Page_SetTextMatrix(Page2, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0); HPDF_Page_TextOut(Page2, 55, 300, "Type \"Ctrl+L\" in order to return from full screen mode."); HPDF_Page_EndText(Page2); HPDF_Page_SetSlideShow(Page2, HPDF_TS_WIPE_UP, 5.0, 1.0); # --- Page3 Page3 = HPDF_AddPage(pdf); HPDF_Page_SetWidth(Page3, width); HPDF_Page_SetHeight(Page3, height); HPDF_Page_SetRGBFill(Page3, r, g + 0.5, b); HPDF_Page_Rectangle(Page3, 0, 0, width, height); HPDF_Page_Fill(Page3); HPDF_Page_SetRGBFill(Page3, 1.0, 1.0, 1.0); HPDF_Page_SetFontAndSize(Page3, font, 30); HPDF_Page_BeginText(Page3); HPDF_Page_SetTextMatrix(Page3, 0.8, 0.0, 0.0, 1.0, 0.0, 0.0); HPDF_Page_TextOut(Page3, 50, 530, "HPDF_TS_WIPE_LEFT"); HPDF_Page_SetTextMatrix(Page3, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0); HPDF_Page_TextOut(Page3, 55, 300, "Type \"Ctrl+L\" in order to return from full screen mode."); HPDF_Page_EndText(Page3); HPDF_Page_SetSlideShow(Page3, HPDF_TS_WIPE_LEFT, 5.0, 1.0); # --- Page4 Page4 = HPDF_AddPage(pdf); HPDF_Page_SetWidth(Page4, width); HPDF_Page_SetHeight(Page4, height); HPDF_Page_SetRGBFill(Page4, r + 0.6, g, b - 0.2); HPDF_Page_Rectangle(Page4, 0, 0, width, height); HPDF_Page_Fill(Page4); HPDF_Page_SetRGBFill(Page4, 1.0, 1.0, 1.0); HPDF_Page_SetFontAndSize(Page4, font, 30); HPDF_Page_BeginText(Page4); HPDF_Page_SetTextMatrix(Page4, 0.8, 0.0, 0.0, 1.0, 0.0, 0.0); HPDF_Page_TextOut(Page4, 50, 530, "HPDF_TS_WIPE_DOWN"); HPDF_Page_SetTextMatrix(Page4, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0); HPDF_Page_TextOut(Page4, 55, 300, "Type \"Ctrl+L\" in order to return from full screen mode."); HPDF_Page_EndText(Page4); HPDF_Page_SetSlideShow(Page4, HPDF_TS_WIPE_DOWN, 5.0, 1.0); # ***Page1 # --> Next HPDF_Page_BeginText(Page1); HPDF_Page_TextOut(Page1, 680, 50, "Next=>"); HPDF_Page_EndText(Page1); dst = HPDF_Page_CreateDestination(Page2); HPDF_Destination_SetFit(dst); annot = HPDF_Page_CreateLinkAnnot(Page1, rectN, dst); HPDF_LinkAnnot_SetBorderStyle(annot, 0, 0, 0); HPDF_LinkAnnot_SetHighlightMode(annot, HPDF_ANNOT_INVERT_BOX); # ***Page2 # <-- Prev HPDF_Page_BeginText(Page2); HPDF_Page_TextOut(Page2, 50, 50, "<=Prev"); HPDF_Page_EndText(Page2); dst = HPDF_Page_CreateDestination(Page1); HPDF_Destination_SetFit(dst); annot = HPDF_Page_CreateLinkAnnot(Page2, rectP, dst); HPDF_LinkAnnot_SetBorderStyle(annot, 0, 0, 0); HPDF_LinkAnnot_SetHighlightMode(annot, HPDF_ANNOT_INVERT_BOX); # --> Next HPDF_Page_BeginText(Page2); HPDF_Page_TextOut(Page2, 680, 50, "Next=>"); HPDF_Page_EndText(Page2); dst = HPDF_Page_CreateDestination(Page3); HPDF_Destination_SetFit(dst); annot = HPDF_Page_CreateLinkAnnot(Page2, rectN, dst); HPDF_LinkAnnot_SetBorderStyle(annot, 0, 0, 0); HPDF_LinkAnnot_SetHighlightMode(annot, HPDF_ANNOT_INVERT_BOX); # ***Page3 # <-- Prev HPDF_Page_BeginText(Page3); HPDF_Page_TextOut(Page3, 50, 50, "<=Prev"); HPDF_Page_EndText(Page3); dst = HPDF_Page_CreateDestination(Page2); HPDF_Destination_SetFit(dst); annot = HPDF_Page_CreateLinkAnnot(Page3, rectP, dst); HPDF_LinkAnnot_SetBorderStyle(annot, 0, 0, 0); HPDF_LinkAnnot_SetHighlightMode(annot, HPDF_ANNOT_INVERT_BOX); # --> Next HPDF_Page_BeginText(Page3); HPDF_Page_TextOut(Page3, 680, 50, "Next=>"); HPDF_Page_EndText(Page3); dst = HPDF_Page_CreateDestination(Page4); HPDF_Destination_SetFit(dst); annot = HPDF_Page_CreateLinkAnnot(Page3, rectN, dst); HPDF_LinkAnnot_SetBorderStyle(annot, 0, 0, 0); HPDF_LinkAnnot_SetHighlightMode(annot, HPDF_ANNOT_INVERT_BOX); # ***Page4 # <-- Prev HPDF_Page_BeginText(Page4); HPDF_Page_TextOut(Page4, 50, 50, "<=Prev"); HPDF_Page_EndText(Page4); dst = HPDF_Page_CreateDestination(Page3); HPDF_Destination_SetFit(dst); annot = HPDF_Page_CreateLinkAnnot(Page4, rectP, dst); HPDF_LinkAnnot_SetBorderStyle(annot, 0, 0, 0); HPDF_LinkAnnot_SetHighlightMode(annot, HPDF_ANNOT_INVERT_BOX); # # HPDF_SetPageMode(pdf, HPDF_PAGE_MODE_FULL_SCREEN); # save the document to a file HPDF_SaveToFile(pdf, fname); # clean up HPDF_Free(pdf); }