public
anonymous / Default.aspx
Created

  • Download Gist
Default.aspx
ASP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933
<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="WebApplication1._Default" %>
 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControlToolkit" %>
<html id="Html1" runat="server">
<head id="Head1" runat="server">
<script type="text/javascript" src="jspdf.js"></script>
<script type="text/javascript" src="jquery-1.4.1.js"></script>
<script type="text/javascript" src="jspdf.plugin.from_html"></script>
<script type="text/javascript" src="BlobBuilder.js"></script>
<script type="text/javascript" src="BlobBuilder.min.js"></script>
<script type="text/javascript" src="FileSaver.js"></script>
<script type="text/javascript" src="base64.js"></script>
<script type="text/javascript" src="jspdf.plugin.addimage.js"></script>
<script type="text/javascript" src="jspdf.plugin.standard_fonts_metrics.js"></script>
<script type="text/javascript" src="jspdf.PLUGINTEMPLATE.js"></script>
<script type="text/javascript" src="jspdf.plugin.split_text_to_size.js"></script>
<script type="text/javascript" src="jspdf.plugin.ie_below_9_shim.js"></script>
<script type="text/javascript" src="compatibility.js"></script>
 
 
<link rel="Stylesheet" href="CSS/MACD.css" />
<link rel="Stylesheet" href="CSS/Calendar.css" />
<style type="text/css">
.style2
{
width: 148px;
}
.style3
{
width: 35px;
}
.style4
{
width: 212px;
}
.style8
{
width: 365px;
}
.style10
{
width: 80px;
}
.style11
{
width: 103px;
}
.style12
{
width: 131px;
}
.style13
{
width: 109px;
}
.style15
{
width: 186px;
}
.style16
{
width: 302px;
}
.style17
{
width: 155px;
}
.style19
{
width: 445px;
}
.style20
{
width: 296px;
}
</style>
 
</head>
<body>
<form id="Form1" runat="server">
<AjaxControlToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="server">
</AjaxControlToolkit:ToolkitScriptManager>
<script type="text/javascript" src="MACD/jspdf.js"></script>
<script type="text/javascript" src="jquery-1.4.1.js"></script>
<script type="text/javascript" src="jspdf.plugin.from_html"></script>
<script type="text/javascript" src="BlobBuilder.js"></script>
<script type="text/javascript" src="BlobBuilder.min.js"></script>
<script type="text/javascript" src="FileSaver.js"></script>
<script type="text/javascript" src="base64.js"></script>
<script type="text/javascript" src="jspdf.plugin.addimage.js"></script>
<script type="text/javascript" src="jspdf.plugin.standard_fonts_metrics.js"></script>
<script type="text/javascript" src="jspdf.PLUGINTEMPLATE.js"></script>
<script type="text/javascript" src="jspdf.plugin.split_text_to_size.js"></script>
<script type="text/javascript" src="jspdf.plugin.ie_below_9_shim.js"></script>
<script type="text/javascript" src="compatibility.js"></script>
<script type="text/javascript" src="sprintf.js"></script>
<script type="text/javascript" src=""
 
<asp:MultiView runat="server" ID="mvMain">
<asp:View ID="View1" runat="server">
<table>
<tr>
<td width="1200px" align="center">
<asp:Panel ID="Panel4" runat="server" BorderColor="Black" BorderWidth="1px" CssClass="chheader">
<asp:Label ID="Label46" runat="server" CssClass="header"> City Harvest MACD Request form</asp:Label>
</asp:Panel>
</td>
</tr>
</table>
<div style="border-style: none; border-color: inherit; border-width: 1; width: 1180px; vertical-align: top; ">
<div style="width: 582px; float: left">
<table >
<tr>
<td>
<asp:CheckBoxList runat="server" RepeatColumns="5" RepeatDirection="Horizontal" CssClass="label"
CellSpacing="10" ID="cblOne">
<asp:ListItem>NEW</asp:ListItem>
<asp:ListItem>MOVE</asp:ListItem>
<asp:ListItem>ADD</asp:ListItem>
<asp:ListItem>CHANGE</asp:ListItem>
<asp:ListItem>DELETE</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
</table>
<table width="100%">
<tr>
<td width="130px">
<asp:Label ID="Label42" runat="server" CssClass="text">Request Date</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtRequestDate" Height="21px" Width="155px"></asp:TextBox>
</td>
<AjaxControlToolkit:CalendarExtender ID="CalendarExtender1" runat="server" CssClass="Calendar.css"
Format="MMMM d, yyyy" TargetControlID="txtRequestDate">
</AjaxControlToolkit:CalendarExtender>
</tr>
<tr>
<td width="130px">
<asp:Label ID="Label43" runat="server" CssClass="text">Requested By</asp:Label>
</td>
<td width="400px">
<asp:TextBox runat="server" ID="txtRequestedBy" Width="155px"></asp:TextBox>
</td>
</tr>
<tr>
<td width="130px">
<asp:Label ID="Label47" runat="server" CssClass="text">Start Date</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtStartDateit" Width="155px"></asp:TextBox>
</td>
<AjaxControlToolkit:CalendarExtender ID="CalendarExtender4" runat="server" CssClass="Calendar.css"
Format="MMMM d, yyyy" TargetControlID="txtStartDateIT">
</AjaxControlToolkit:CalendarExtender>
</tr>
<tr>
<td width="130px">
<asp:Label ID="Label48" runat="server" CssClass="text">Termination Date</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtTermination" Width="155px"></asp:TextBox>
</td>
<AjaxControlToolkit:CalendarExtender ID="CalendarExtender5" runat="server" CssClass="Calendar.css"
Format="MMMM d, yyyy" TargetControlID="txtTermination">
</AjaxControlToolkit:CalendarExtender>
</tr>
</table>
</div>
<div style="border: 2px solid black; width: 475px; float:none; background-color: #CAE1FF; ">
<table style="width: 496px">
<tr>
<td class="style4">
<asp:Label ID="Label29" runat="server" CssClass="text">IT Use Only</asp:Label>
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label30" runat="server" CssClass="text">Received Date</asp:Label>
</td>
<td class="style19">
<asp:TextBox runat="server" ID="txtReceivedDate" Enabled="false"></asp:TextBox>
</td>
<AjaxControlToolkit:CalendarExtender ID="CalendarExtender2" runat="server" CssClass="Calendar.css"
Format="MMMM d, yyyy" TargetControlID="txtReceivedDate">
</AjaxControlToolkit:CalendarExtender>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label44" runat="server" CssClass="text">Received By</asp:Label>
</td>
<td class="style19">
<asp:TextBox runat="server" ID="txtReceivedBy" Enabled="false"></asp:TextBox>
</td>
</tr>
</table>
</div>
</div>
<table>
<tr>
<td width="1200px" align="center">
<asp:Panel ID="Panel1" runat="server" BorderColor="Black" BorderWidth="1px" CssClass= "subheader">
<asp:Label ID="Label1" runat="server" CssClass="subtextheader">Employee Information</asp:Label>
</asp:Panel>
</td>
</tr>
</table>
<table>
<tr>
<td>
<asp:CheckBoxList ID="cblTwo" runat="server" RepeatColumns="7" RepeatDirection="Horizontal"
CssClass="text" CellSpacing="10">
<asp:ListItem>Full-Time</asp:ListItem>
<asp:ListItem>Part-Time</asp:ListItem>
<asp:ListItem>Temp</asp:ListItem>
<asp:ListItem>Volunteer</asp:ListItem>
<asp:ListItem>Intern</asp:ListItem>
<asp:ListItem>Contractor</asp:ListItem>
<asp:ListItem>Vista</asp:ListItem>
</asp:CheckBoxList>
</td>
<td>
<asp:CheckBoxList ID="CheckBoxList8" runat="server" RepeatDirection="Horizontal"
CssClass="label" CellSpacing="10">
<asp:ListItem>SUPERVISOR</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
</table>
<div style="width: 1200px; vertical-align: top">
<div style="width: 590px; float: left">
<table>
<tr>
<td width="138px">
<asp:Label ID="Label2" runat="server" CssClass="text">Title</asp:Label>
</td>
<td class="style8">
<asp:TextBox runat="server" ID="txtTitle" Width="300px"></asp:TextBox>
</td>
</tr>
<tr>
<td width="135px">
<asp:Label ID="Label3" runat="server" CssClass="text">Full Name</asp:Label>
</td>
<td class="style8">
<asp:TextBox runat="server" ID="txtFullName" Width="300px"></asp:TextBox>
</td>
</tr>
<tr>
<td width="135px">
<asp:Label runat="server" CssClass="text">Supervisor</asp:Label>
</td>
<td class="style8">
<asp:TextBox runat="server" ID="txtSupervisor" Width="300px"></asp:TextBox>
</td>
</tr>
<tr>
<td width="142px">
<asp:Label runat="server" CssClass="text" Width="130px">Department/Location</asp:Label>
</td>
<td class="style8">
<asp:TextBox runat="server" ID="txtDepartment" Width="300px"></asp:TextBox>
</td>
</tr>
</table>
</div>
<div style="float: center; width: 496px; border-width: 2px; border-style: solid">
<table>
<tr>
<td>
<asp:Label runat="server" CssClass="panelText">This section is for MOVES and CHANGES only</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" CssClass="text">New Role</asp:Label>
</td>
<td class="style20">
<asp:TextBox runat="server" ID="txtNewRole" Width="290px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label6" runat="server" CssClass="text">New Name</asp:Label>
</td>
<td class="style20">
<asp:TextBox ID="txtNewName" runat="server" Width="290px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label7" runat="server" CssClass="text">New Department/Location</asp:Label>
</td>
<td class="style20">
<asp:TextBox ID="txtNewDepartment" runat="server" Width="290px"></asp:TextBox>
</td>
</tr>
</table>
</div>
</div>
<table>
<tr>
<td width="1200px" align="center">
<asp:Panel ID="Panel2" runat="server" BorderColor="Black" BorderWidth="1px" CssClass= "subheader">
<asp:Label ID="Label8" runat="server" CssClass="subtextheader">IT Equipment</asp:Label>
</asp:Panel>
</td>
</tr>
</table>
<table>
<tr>
<td width="135px">
<asp:Label ID="Label9" runat="server" CssClass="text" Width="125px">Computer</asp:Label>
</td>
<td>
<asp:CheckBox runat="server" ID="txtComputer" Text="Yes" CssClass="text" Width="100px">
</asp:CheckBox>
</td>
<td width="125px">
<asp:Label runat="server" CssClass="text" Width="125px">Comment</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtExplainC" Width="733px"></asp:TextBox>
</td>
</tr>
</table>
<table>
<tr>
<td width="135px">
<asp:Label ID="Label10" runat="server" CssClass="text" Width="125px">Office Phone</asp:Label>
</td>
<td>
<asp:CheckBox runat="server" ID="txtOfficePhn" Text="Yes" CssClass="text" Width="100px">
</asp:CheckBox>
</td>
<td>
<table>
<tr>
<td width="125px">
<asp:Label runat="server" CssClass="text" Width="125px">New Extension</asp:Label>
</td>
<td class="style10">
<asp:CheckBox runat="server" ID="txtNewExtension" Text="Yes" CssClass="text"></asp:CheckBox>
</td>
<td>
<asp:Label runat="server" CssClass="text" Width="100px">Comment</asp:Label>
</td>
<td class="style13">
<asp:TextBox runat="server" ID="txtOther" Style="margin-left: 0px"
Width="560px"></asp:TextBox>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td width="135px">
<asp:Label runat="server" CssClass="text" Width="125px">Voicemail</asp:Label>
</td>
<td width="100px">
<asp:CheckBox runat="server" ID="txtVM" Text="Yes" CssClass="text" Width="100px">
</asp:CheckBox>
</td>
<td width="125px">
<asp:Label ID="Label4" runat="server" CssClass="text" Width="125px">Comment</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="TextBox3" Width="733px"></asp:TextBox>
</td>
</tr>
</table>
<table>
<tr>
<td width="135px">
<asp:Label runat="server" CssClass="text" Width="125px">Mobile</asp:Label>
</td>
<td>
<asp:CheckBox runat="server" ID="txtMobile" Text="Yes" CssClass="text" Width="100px">
</asp:CheckBox>
</td>
<td>
<table>
<tr>
<td>
<asp:Label runat="server" CssClass="text" Width="125px">Internet/Email</asp:Label>
</td>
<td class="style10">
<asp:CheckBox runat="server" ID="txtIE" Text="Yes" CssClass="text"></asp:CheckBox>
</td>
<td class="style11">
<asp:Label runat="server" CssClass="text">Comment</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtExplainM" Width="560px"></asp:TextBox>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td width="135px">
<asp:Label runat="server" CssClass="text" Width="125px">Other</asp:Label>
</td>
<td>
<asp:CheckBox runat="server" ID="txtPS" Text="Yes" CssClass="text" Width="100px">
</asp:CheckBox>
</td>
<td class="style12" width="125px">
<asp:Label runat="server" CssClass="text">Comment</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtExplainPS" Width="755px"></asp:TextBox>
</td>
</tr>
</table>
<table>
<tr>
<td width="1200px" align="center">
<asp:Panel ID="Panel3" runat="server" BorderColor="Black" BorderWidth="1px" CssClass= "subheader">
<asp:Label runat="server" CssClass="subtextheader">Network Access</asp:Label>
</asp:Panel>
</td>
</tr>
</table>
<table>
<tr>
<td>
<asp:Label runat="server" CssClass="text" ForeColor="Red">****All users automatically receive the P, the M, and G Drives. A VP must authorize VPN Remote Access</asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td width="180px">
<asp:Label runat="server" CssClass="text">Drive Letter</asp:Label>
</td>
<td width="200px">
<asp:TextBox runat="server" ID="txtDL1" Width="100px"></asp:TextBox>
</td>
<td width="150px">
<asp:Label runat="server" CssClass="text" Width="150px">Folder 1</asp:Label>
</td>
<td width="300px">
<asp:TextBox runat="server" ID="txtF1" Width="200px"></asp:TextBox>
</td>
<td width="150px">
<asp:Label runat="server" CssClass="text" Width="150px">Folder 2</asp:Label>
</td>
<td width="300px">
<asp:TextBox runat="server" ID="txtF2"></asp:TextBox>
</td>
</tr>
<tr>
<td width="180px">
<asp:Label runat="server" CssClass="text">Drive Letter</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtDL2" Width="100px"></asp:TextBox>
</td>
<td>
<asp:Label runat="server" CssClass="text">Folder 1</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtF3" Width="200px"></asp:TextBox>
</td>
<td width="150px">
<asp:Label runat="server" CssClass="text">Folder 2</asp:Label>
</td>
<td width="300px">
<asp:TextBox runat="server" ID="txtF4"></asp:TextBox>
</td>
</tr>
</table>
<table>
<tr>
<td class="style17">
<asp:Label runat="server" CssClass="text">Email</asp:Label>
</td>
<td class="style15">
<asp:CheckBox runat="server" ID="txtEmail" Text="Yes" CssClass="text" EnableTheming="False">
</asp:CheckBox>
</td>
<td>
<asp:Label runat="server" CssClass="text">Comment</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtExplainEmail" Width="800px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style17">
<asp:Label ID="Label33" runat="server" CssClass="text">Remote Access</asp:Label>
</td>
<td class="style15">
<asp:CheckBox runat="server" ID="txtRA" Text="Yes" CssClass="text" OnCheckedChanged="txtRA_CheckedChanged"
></asp:CheckBox>
</td>
<td>
<asp:Label ID="Label34" runat="server" CssClass="text">Comment</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtRAExplain" Width="800px"></asp:TextBox>
</td>
</tr>
</table>
<table>
<tr>
<td width="1200px" align="center">
<asp:Panel runat="server" BorderColor="Black" BorderWidth="1px" CssClass= "subheader">
<asp:Label ID="Label45" runat="server" CssClass="subtextheader">Application Access</asp:Label>
</asp:Panel>
</td>
</tr>
</table>
<table>
<tr>
<td width="115px">
<asp:Label runat="server" CssClass="text">Dynamics GP</asp:Label>
</td>
<td>
<asp:CheckBoxList ID="cbDynamics" runat="server" RepeatColumns="7" RepeatDirection="Horizontal"
CssClass="text" CellSpacing="5">
<asp:ListItem>AP Clerk</asp:ListItem>
<asp:ListItem>Purchasing Agent</asp:ListItem>
<asp:ListItem>Accounting Manager</asp:ListItem>
<asp:ListItem>Administrator</asp:ListItem>
<asp:ListItem>Power User</asp:ListItem>
<asp:ListItem>IMS User</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td width="115px">
<asp:Label ID="Label49" runat="server" CssClass="text">Forecaster</asp:Label>
</td>
<td>
<asp:CheckBoxList ID="cblForecaster" runat="server" RepeatColumns="7" RepeatDirection="Horizontal"
CssClass="text" CellSpacing="5">
<asp:ListItem>Planner</asp:ListItem>
<asp:ListItem>Administrator</asp:ListItem>
<asp:ListItem>Analyst</asp:ListItem>
<asp:ListItem>Viewer</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td width="115px">
<asp:Label ID="Label50" runat="server" CssClass="text">FRx</asp:Label>
</td>
<td>
<asp:CheckBoxList ID="cblFrx" runat="server" RepeatColumns="7" RepeatDirection="Horizontal"
CssClass="text" CellSpacing="5">
<asp:ListItem>Administrator</asp:ListItem>
<asp:ListItem>Finance</asp:ListItem>
<asp:ListItem>User</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td width="115px">
<asp:Label ID="Label51" runat="server" CssClass="text">Integration Mgr</asp:Label>
</td>
<td>
<asp:CheckBoxList ID="cbIM" runat="server" RepeatColumns="7" RepeatDirection="Horizontal"
CssClass="text" CellSpacing="5">
<asp:ListItem>Yes</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td width="115px">
<asp:Label ID="Label5" runat="server" CssClass="text">Raiser's Edge</asp:Label>
</td>
<td>
<asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatColumns="7" RepeatDirection="Horizontal"
CssClass="text" CellSpacing="5">
<asp:ListItem>User</asp:ListItem>
<asp:ListItem>Power User</asp:ListItem>
<asp:ListItem>Administrator</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
 
<tr>
<td width="115px">
<asp:Label ID="Label18" runat="server" CssClass="text">Papersave</asp:Label>
</td>
<td>
<asp:CheckBoxList ID="CheckBoxList2" runat="server" RepeatColumns="7" RepeatDirection="Horizontal"
CssClass="text" CellSpacing="5">
<asp:ListItem>User</asp:ListItem>
<asp:ListItem>Power User</asp:ListItem>
<asp:ListItem>Administrator</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
</table>
<table>
<tr>
<td>
<asp:Label runat="server">_____________________________________________________________________________________________________________________________________________________</asp:Label>
</td>
</tr>
<tr>
<td width="130px">
<asp:Label ID="Label11" runat="server" CssClass="text">ADP</asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td>
<asp:Label runat="server" CssClass="text" ForeColor="Red"> By default all users are setup as a "User" with access to view personal information only in the selected modules. Please select ONLY the needed module(s) for these users.</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label12" runat="server" CssClass="text" ForeColor="Red">If additional access beyond that of a normal user is required please select a role from the Security Role and Portal Access in each section.</asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td width="130px">
<asp:Label ID="Label13" runat="server" CssClass="text">Module</asp:Label>
</td>
<td>
<asp:CheckBoxList ID="CheckBoxList3" runat="server" RepeatColumns="7" RepeatDirection="Horizontal"
CssClass="text" CellSpacing="5" OnSelectedIndexChanged="CheckBoxList3_SelectedIndexChanged">
<asp:ListItem>HR Benefits</asp:ListItem>
<asp:ListItem>Time/Attendance</asp:ListItem>
<asp:ListItem>Payroll</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label14" runat="server" CssClass="text">Security Role</asp:Label>
</td>
<td>
<asp:CheckBoxList ID="CheckBoxList4" runat="server" RepeatColumns="7" RepeatDirection="Horizontal"
CssClass="text" CellSpacing="5" AutoPostBack="True" OnSelectedIndexChanged="CheckBoxList4_SelectedIndexChanged">
<asp:ListItem>Master</asp:ListItem>
<asp:ListItem>Admin</asp:ListItem>
<asp:ListItem>Backup Master</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label16" runat="server" CssClass="text">Portal Access</asp:Label>
</td>
<td>
<asp:CheckBoxList ID="CheckBoxList6" runat="server" RepeatColumns="7" RepeatDirection="Horizontal"
CssClass="text" CellSpacing="5">
<asp:ListItem>Admin</asp:ListItem>
<asp:ListItem>Practitioner</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
</table>
<table>
<tr>
<td width="1200px" align="center">
<asp:Panel runat="server" BorderColor="Black" BorderWidth="1px" CssClass= "subheader">
<asp:Label ID="Label35" runat="server" CssClass="subtextheader">Approvals</asp:Label>
</asp:Panel>
</td>
</tr>
</table>
<table>
<tr>
<td>
<asp:Label runat="server" CssClass="text" ForeColor="Red">A Director-Level supervisor or above signature is required. Please allow for up to 10 business days to process request.New users will not be granted access until this form is signed and they have completed a satisfactory background check by Human Resources.</asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td class="style2" width="130px">
<asp:Label ID="Label36" runat="server" CssClass="text">Supervisor Signature</asp:Label>
</td>
<td width="600px">
<asp:TextBox runat="server" ID="txtSS" Width="450px" TextMode="MultiLine" Enabled="False"
Rows="3"></asp:TextBox>
</td>
<td class="style3">
<asp:Label ID="Label37" runat="server" CssClass="text">Date</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtDate1" Height="42px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2" width="130px">
<asp:Label ID="Label38" runat="server" CssClass="text">HR Signature</asp:Label>
</td>
<td width="600px">
<asp:TextBox runat="server" ID="txtHRS" Width="450px" TextMode="MultiLine" Enabled="False"
Rows="3"></asp:TextBox>
</td>
<td class="style3">
<asp:Label ID="Label39" runat="server" CssClass="text">Date</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtDate2" Height="42px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2" width="130px">
<asp:Label ID="Label40" runat="server" CssClass="text" TextMode="MultiLine">IT Signature</asp:Label>
</td>
<td width="600px">
<asp:TextBox runat="server" ID="txtITS" Width="450px" Enabled="False" Rows="3" TextMode="MultiLine"></asp:TextBox>
</td>
<td class="style3">
<asp:Label ID="Label41" runat="server" CssClass="text">Date</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="txtDate3" Height="42px"></asp:TextBox>
</td>
</tr>
<asp:Panel runat="server" ID="pnlVP" >
<tr>
<td>
<asp:Label runat="server" CssClass="text" TextMode="MultiLine">VP Signature</asp:Label>
</td>
<td width="600px">
<asp:TextBox runat="server" ID="TextBox1" Width="450px" Enabled="False" Rows="3"
TextMode="MultiLine"></asp:TextBox>
</td>
<td width="45px">
<asp:Label runat="server" CssClass="text">Date</asp:Label>
</td>
<td>
<asp:TextBox runat="server" ID="TextBox2" Height="42px"></asp:TextBox>
</td>
</tr>
</asp:Panel>
</table>
<table>
<tr>
<td width="1000px" align="center">
<asp:Button runat="server" ID="btnSubmit" Text="Read Polices" OnClick="btnSubmit_Click"
Visible="true" Width="149px" />
<input type="button" value="Print for signature" OnClick="window.print();" size="149px"
style="margin-left: 22px">
 
<input type="button" value="Save as PDF" OnClick="new jsPDF().save('test.pdf');" />
</td>
</tr>
</table>
</asp:View>
<asp:View ID="View2" runat="server">
<div>
<asp:Label runat="server">An email has been sent to IT regarding the details of this request.</asp:Label>
</div>
</asp:View>
<asp:View ID="View3" runat="server">
<table>
<tr>
<td width="1200px" align="center">
<asp:Panel runat="server" BorderColor="Black" BorderWidth="1px" CssClass="mainheader">
<asp:Label ID="Label52" runat="server" CssClass="header">Policies</asp:Label>
</asp:Panel>
</td>
</tr>
</table>
<table>
<tr>
<td width="1200px" align="center">
<asp:Panel ID="Panel7" runat="server" BorderColor="Black" BorderWidth="1px">
<asp:Label ID="Label60" runat="server" CssClass="header">Protocol</asp:Label>
</asp:Panel>
</td>
</tr>
</table>
<table>
<tr>
<td>
<asp:Label runat="server" CssClass="text">General:All requests are governed by policies on this page of the form. For all user equipment and network access requests, supervisor should submit form as follows:</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label54" runat="server" CssClass="text"> • New users and equipment: Supervisor and/or VP Submits to IT (10) business days prior to requested Start date. </asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label55" runat="server" CssClass="text"> • Moves/Adds/Changes for existing users: Supervisor submits form to IT (5) business days prior to Start date.</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label56" runat="server" CssClass="text"> • Delete: Supervisor notifies IT. Network access will be deleted ASAP, preferably same day as termination date on form. </asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td width="1200px" align="center">
<asp:Panel ID="Panel8" runat="server" BorderColor="Black" BorderWidth="1px">
<asp:Label ID="Label69" runat="server" CssClass="header">COMPUTER & NETWORK EQUIPMENT </asp:Label>
</asp:Panel>
</td>
</tr>
</table>
<table>
<tr>
<td>
<asp:Label ID="Label70" runat="server" CssClass="text"> General: Please be advised of the following: (1) NEW users may require purchasing new equipment. (2) Existing users changing roles, locations, or functionality may require new or re-configured equipment when requests are made. Therefore, without proper advance notice, we cannot guarantee the user setup will be complete by the start date. </asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" CssClass="text">• New Users: To guarantee the NEW user is setup by the requested start date, IT requires advance notice of at least (10) business-days for all NEW user requests regardless of employee status. </asp:Label>
</td>
<tr>
<td>
<asp:Label runat="server" CssClass="text">• Existing users: To guarantee Changes to Existing user equipment are setup by the requested start date, IT requires advance notice of at least (5) business-days for all other user equipment requests regardless of employee status.</asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td width="1200px" align="center">
<asp:Panel runat="server" BorderColor="Black" BorderWidth="1px">
<asp:Label runat="server" CssClass="header">COMPUTER NETWORK SERVICES</asp:Label>
</asp:Panel>
</td>
</tr>
</table>
<table>
<tr>
<td>
<asp:Label runat="server" CssClass="text">General: Full-time City Harvest employees will be eligible for all the below services and granted access based on the permission requested in the user setup form. In most cases, the existing computer will be modified for existing users or reconfigured for the new users. If there is no existing computer for this user, the IT department will provision equipment which may add additional time to the request based on funding and availability. Employees with the status of Consultant/Contractor, Temp, Volunteer, and Intern will be eligible for limited access to CH systems as described below. Non-City Harvest employees will not be eligible for access other than Internet via the CH wireless network. The following items are configured as per information on the form:</asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td>
<asp:Label runat="server" CssClass="text">• Standard Software Installation: All Desktop PCs will have Windows 7, Internet Explorer 8, MS office 2007 & Anti-Virus.</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" CssClass="text">• Other Software Installation: Software applications (HEROS, Dynamics GP, Raiser’s Edge, UPS) are installed based on the employee type and department. You can specify additional special software you would like installed. During installation, IT will check to see if licensing is available from your department to assign. Any new or additional licensing purchases required for applications will result in additional lead time of up to (3) business days in addition to the normal (5) business day setup. </asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" CssClass="text">• Internet Access: Full-time users, Contractors, and Temps with completed background checks and/or contracts will be granted Internet access unless otherwise stated on the form. Interns and volunteers will not be granted access.</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" CssClass="text">• Exchange Email Address: Employees receive standardized email addresses [first initial + last name + @CityHarvest.org]. Full Time employees and Temps who have completed background checks are eligible to receive City Harvest email address and limited access to network resources. Volunteers, Interns, and Consultants will not receive a personal email address</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" CssClass="text">• Email Distribution Lists: The employee is added to or deleted from the specified mail lists based on user form requests.</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" CssClass="text">• Web Portal: The User will be added to the CH Portal at the same time the user is given a username/password combo.</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label53" runat="server" CssClass="text">• Network Access: All eligible employees will have access to the specified network folders, their personal folders, and portal shares. Volunteers and Interns will receive a GENERAL network login/password combo that allows them access to only the systems necessary for them to perform their direct job function. </asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" CssClass="text"> • VPN Access: Only FULL-TIME employees with a completed 90-day probationary period will be granted access to our VPN for business purposes only. Access may be assessed individually on a case-by-case basis however only a VP can approve VPN access. All other users will be limited to remote email access only through our Outlook Webmail server at https://webmail.cityharvest.org
</asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td width="1200px" align="center">
<asp:Panel runat="server" BorderColor="Black" BorderWidth="1px">
<asp:Label runat="server" CssClass="header">VOICE & MOBILE SERVICES</asp:Label>
</asp:Panel>
</td>
</tr>
</table>
<table>
<tr>
<td>
<asp:Label runat="server" CssClass="text">General: All NEW CH employees will be assigned an office extension. A mobile phone may be provided to Full-time City Harvest Employees provided a business case exists. The phone may be configured with Data, voice, and email upon request by the supervisor.</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" CssClass="text">• Phone Extension Move/ Change: IT will Assign existing phone line at desk/cubicle to new employee (the voicemail password is reset for temporary use by the new employee). If there is a need to change extensions, or change locations, for existing employee, we will need to see where new location is and know what happens to old location when we move it. IT may have to contact phone vendor for phone systems programming support. Please provide </asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" CssClass="text">• Mobile Phone: If an extra mobile phone is available, we will be able to re-configure the phone for the new user. This process can take up to (5) business days depending on configuration of phone. </asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label runat="server" CssClass="text">• Blackberry: Purchase of any new or changes to any existing Blackberry Enterprise Server (BES) license will result in additional lead time requirements of up to (3) business days.</asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td width="1000px" align="center">
<asp:Button runat="server" ID="btnBack" Text="Back" Visible="true" Width="149px" />
</td>
</tr>
</table>
</asp:View>
</asp:MultiView>
</form>
</body>
</html>
jspdf.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832
/** @preserve jsPDF 0.9.0rc1 ( ${buildDate} ${commitID} )
Copyright (c) 2010-2012 James Hall, james@snapshotmedia.co.uk, https://github.com/MrRio/jsPDF
Copyright (c) 2012 Willow Systems Corporation, willow-systems.com
MIT license.
*/
 
/*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
 
 
/**
Creates new jsPDF document object instance
@class
@param orientation One of "portrait" or "landscape" (or shortcuts "p" (Default), "l")
@param unit Measurement unit to be used when coordinates are specified. One of "pt" (points), "mm" (Default), "cm", "in"
@param format One of 'a3', 'a4' (Default),'a5' ,'letter' ,'legal'
@returns {jsPDF}
@name jsPDF
*/
var jsPDF = (function() {
'use strict'
 
// this will run on <=IE9, possibly some niche browsers
// new webkit-based, FireFox, IE10 already have native version of this.
if (typeof btoa === 'undefined') {
window.btoa = function(data) {
// DO NOT ADD UTF8 ENCODING CODE HERE!!!!
 
// UTF8 encoding encodes bytes over char code 128
// and, essentially, turns an 8-bit binary streams
// (that base64 can deal with) into 7-bit binary streams.
// (by default server does not know that and does not recode the data back to 8bit)
// You destroy your data.
 
// binary streams like jpeg image data etc, while stored in JavaScript strings,
// (which are 16bit arrays) are in 8bit format already.
// You do NOT need to char-encode that before base64 encoding.
 
// if you, by act of fate
// have string which has individual characters with code
// above 255 (pure unicode chars), encode that BEFORE you base64 here.
// you can use absolutely any approch there, as long as in the end,
// base64 gets an 8bit (char codes 0 - 255) stream.
// when you get it on the server after un-base64, you must
// UNencode it too, to get back to 16, 32bit or whatever original bin stream.
 
// Note, Yes, JavaScript strings are, in most cases UCS-2 -
// 16-bit character arrays. This does not mean, however,
// that you always have to UTF8 it before base64.
// it means that if you have actual characters anywhere in
// that string that have char code above 255, you need to
// recode *entire* string from 16-bit (or 32bit) to 8-bit array.
// You can do binary split to UTF16 (BE or LE)
// you can do utf8, you can split the thing by hand and prepend BOM to it,
// but whatever you do, make sure you mirror the opposite on
// the server. If server does not expect to post-process un-base64
// 8-bit binary stream, think very very hard about messing around with encoding.
 
// so, long story short:
// DO NOT ADD UTF8 ENCODING CODE HERE!!!!
/* @preserve
====================================================================
base64 encoder
MIT, GPL
version: 1109.2015
discuss at: http://phpjs.org/functions/base64_encode
+ original by: Tyler Akins (http://rumkin.com)
+ improved by: Bayron Guevara
+ improved by: Thunder.m
+ improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+ bugfixed by: Pellentesque Malesuada
+ improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+ improved by: Rafal Kukawski (http://kukawski.pl)
+ Daniel Dotsenko, Willow Systems Corp, willow-systems.com
====================================================================
*/
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
, b64a = b64.split('')
, o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
enc = "",
tmp_arr = [];
do { // pack three octets into four hexets
o1 = data.charCodeAt(i++);
o2 = data.charCodeAt(i++);
o3 = data.charCodeAt(i++);
bits = o1 << 16 | o2 << 8 | o3;
 
h1 = bits >> 18 & 0x3f;
h2 = bits >> 12 & 0x3f;
h3 = bits >> 6 & 0x3f;
h4 = bits & 0x3f;
// use hexets to index into b64, and append result to encoded string
tmp_arr[ac++] = b64a[h1] + b64a[h2] + b64a[h3] + b64a[h4];
} while (i < data.length);
 
enc = tmp_arr.join('');
var r = data.length % 3;
return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
 
// end of base64 encoder MIT, GPL
};
}
 
if (typeof atob === 'undefined') {
window.atob = function (data) {
// http://kevin.vanzonneveld.net
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Thunder.m
// + input by: Aman Gupta
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// * example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA==');
// * returns 1: 'Kevin van Zonneveld'
// mozilla has this native
// - but breaks in 2.0.0.12!
//if (typeof this.window['atob'] == 'function') {
// return atob(data);
//}
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
dec = "",
tmp_arr = [];
 
if (!data) {
return data;
}
 
data += '';
 
do { // unpack four hexets into three octets using index points in b64
h1 = b64.indexOf(data.charAt(i++));
h2 = b64.indexOf(data.charAt(i++));
h3 = b64.indexOf(data.charAt(i++));
h4 = b64.indexOf(data.charAt(i++));
 
bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;
 
o1 = bits >> 16 & 0xff;
o2 = bits >> 8 & 0xff;
o3 = bits & 0xff;
 
if (h3 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1);
} else if (h4 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1, o2);
} else {
tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
}
} while (i < data.length);
 
dec = tmp_arr.join('');
 
return dec;
};
}
 
var getObjectLength = typeof Object.keys === 'function' ?
function(object){
return Object.keys(object).length
} :
function(object){
var i = 0
for (var e in object){if(object.hasOwnProperty(e)){ i++ }}
return i
}
 
/**
PubSub implementation
 
@class
@name PubSub
*/
var PubSub = function(context){
'use strict'
/** @preserve
-----------------------------------------------------------------------------------------------
JavaScript PubSub library
2012 (c) ddotsenko@willowsystems.com
based on Peter Higgins (dante@dojotoolkit.org)
Loosely based on Dojo publish/subscribe API, limited in scope. Rewritten blindly.
Original is (c) Dojo Foundation 2004-2010. Released under either AFL or new BSD, see:
http://dojofoundation.org/license for more information.
-----------------------------------------------------------------------------------------------
*/
/**
@private
@fieldOf PubSub
*/
this.topics = {}
/**
Stores what will be `this` within the callback functions.
 
@private
@fieldOf PubSub#
*/
this.context = context
/**
Allows caller to emit an event and pass arguments to event listeners.
@public
@function
@param topic {String} Name of the channel on which to voice this event
@param **args Any number of arguments you want to pass to the listeners of this event.
@methodOf PubSub#
@name publish
*/
this.publish = function(topic, args) {
'use strict'
if (this.topics[topic]) {
var currentTopic = this.topics[topic]
, args = Array.prototype.slice.call(arguments, 1)
, toremove = []
, fn
, i, l
, pair
 
for (i = 0, l = currentTopic.length; i < l; i++) {
pair = currentTopic[i] // this is a [function, once_flag] array
fn = pair[0]
if (pair[1] /* 'run once' flag set */){
pair[0] = function(){}
toremove.push(i)
}
fn.apply(this.context, args)
}
for (i = 0, l = toremove.length; i < l; i++) {
currentTopic.splice(toremove[i], 1)
}
}
}
/**
Allows listener code to subscribe to channel and be called when data is available
@public
@function
@param topic {String} Name of the channel on which to voice this event
@param callback {Function} Executable (function pointer) that will be ran when event is voiced on this channel.
@param once {Boolean} (optional. False by default) Flag indicating if the function is to be triggered only once.
@returns {Object} A token object that cen be used for unsubscribing.
@methodOf PubSub#
@name subscribe
*/
this.subscribe = function(topic, callback, once) {
'use strict'
if (!this.topics[topic]) {
this.topics[topic] = [[callback, once]];
} else {
this.topics[topic].push([callback,once]);
}
return {
"topic": topic,
"callback": callback
};
};
/**
Allows listener code to unsubscribe from a channel
@public
@function
@param token {Object} A token object that was returned by `subscribe` method
@methodOf PubSub#
@name unsubscribe
*/
this.unsubscribe = function(token) {
if (this.topics[token.topic]) {
var currentTopic = this.topics[token.topic]
for (var i = 0, l = currentTopic.length; i < l; i++) {
if (currentTopic[i][0] === token.callback) {
currentTopic.splice(i, 1)
}
}
}
}
}
 
/**
@constructor
@private
*/
function jsPDF(/** String */ orientation, /** String */ unit, /** String */ format){
 
// Default parameter values
if (typeof orientation === 'undefined') orientation = 'p'
else orientation = orientation.toString().toLowerCase()
if (typeof unit === 'undefined') unit = 'mm'
if (typeof format === 'undefined') format = 'a4'
 
var format_as_string = format.toString().toLowerCase()
, version = '20120619'
, content = []
, content_length = 0
 
, pdfVersion = '1.3' // PDF Version
, pageFormats = { // Size in pt of various paper formats
'a3': [841.89, 1190.55]
, 'a4': [595.28, 841.89]
, 'a5': [420.94, 595.28]
, 'letter': [612, 792]
, 'legal': [612, 1008]
}
, textColor = '0 g'
, drawColor = '0 G'
, page = 0
, pages = []
, objectNumber = 2 // 'n' Current object number
, outToPages = false // switches where out() prints. outToPages true = push to pages obj. outToPages false = doc builder content
, offsets = [] // List of offsets. Activated and reset by buildDocument(). Pupulated by various calls buildDocument makes.
, fonts = {} // collection of font objects, where key is fontKey - a dynamically created label for a given font.
, fontmap = {} // mapping structure fontName > fontStyle > font key - performance layer. See addFont()
, activeFontSize = 16
, activeFontKey // will be string representing the KEY of the font as combination of fontName + fontStyle
, lineWidth = 0.200025 // 2mm
, pageHeight
, pageWidth
, k // Scale factor
, documentProperties = {'title':'','subject':'','author':'','keywords':'','creator':''}
, lineCapID = 0
, lineJoinID = 0
, API = {}
, events = new PubSub(API)
 
if (unit == 'pt') {
k = 1
} else if(unit == 'mm') {
k = 72/25.4
} else if(unit == 'cm') {
k = 72/2.54
} else if(unit == 'in') {
k = 72
} else {
throw('Invalid unit: ' + unit)
}
// Dimensions are stored as user units and converted to points on output
if (format_as_string in pageFormats) {
pageHeight = pageFormats[format_as_string][1] / k
pageWidth = pageFormats[format_as_string][0] / k
} else {
try {
pageHeight = format[1]
pageWidth = format[0]
}
catch(err) {
throw('Invalid format: ' + format)
}
}
if (orientation === 'p' || orientation === 'portrait') {
orientation = 'p'
if ( pageWidth > pageHeight ) {
var tmp = pageWidth
pageWidth = pageHeight
pageHeight = tmp
}
} else if (orientation === 'l' || orientation === 'landscape') {
orientation = 'l'
if ( pageHeight > pageWidth ) {
var tmp = pageWidth
pageWidth = pageHeight
pageHeight = tmp
}
} else {
throw('Invalid orientation: ' + orientation)
}
 
/////////////////////
// Private functions
/////////////////////
// simplified (speedier) replacement for sprintf's %.2f conversion
var f2 = function(number){
return number.toFixed(2)
}
// simplified (speedier) replacement for sprintf's %.3f conversion
, f3 = function(number){
return number.toFixed(3)
}
// simplified (speedier) replacement for sprintf's %02d
, padd2 = function(number) {
var n = (number).toFixed(0)
if ( number < 10 ) return '0' + n
else return n
}
// simplified (speedier) replacement for sprintf's %02d
, padd10 = function(number) {
var n = (number).toFixed(0)
if (n.length < 10) return new Array( 11 - n.length ).join( '0' ) + n
else return n
}
, out = function(string) {
if(outToPages /* set by beginPage */) {
pages[page].push(string)
} else {
content.push(string)
content_length += string.length + 1 // +1 is for '\n' that will be used to join contents of content
}
}
, newObject = function() {
// Begin a new object
objectNumber ++
offsets[objectNumber] = content_length
out(objectNumber + ' 0 obj');
return objectNumber
}
, putPages = function() {
var wPt = pageWidth * k
var hPt = pageHeight * k
 
// outToPages = false as set in endDocument(). out() writes to content.
var n, p
for(n=1; n <= page; n++) {
newObject()
out('<</Type /Page')
out('/Parent 1 0 R');
out('/Resources 2 0 R')
out('/Contents ' + (objectNumber + 1) + ' 0 R>>')
out('endobj')
// Page content
p = pages[n].join('\n')
newObject()
out('<</Length ' + p.length + '>>')
putStream(p)
out('endobj')
}
offsets[1] = content_length
out('1 0 obj')
out('<</Type /Pages')
var kids = '/Kids ['
for (var i = 0; i < page; i++) {
kids += (3 + 2 * i) + ' 0 R '
}
out(kids + ']')
out('/Count ' + page)
out('/MediaBox [0 0 '+f2(wPt)+' '+f2(hPt)+']')
out('>>')
out('endobj');
}
, putStream = function(str) {
out('stream')
out(str)
out('endstream')
}
, putResources = function() {
putFonts()
events.publish('putResources')
// Resource dictionary
offsets[2] = content_length
out('2 0 obj')
out('<<')
putResourceDictionary()
out('>>')
out('endobj')
}
, putFonts = function() {
for (var fontKey in fonts) {
if (fonts.hasOwnProperty(fontKey)) {
putFont(fonts[fontKey])
}
}
}
, putFont = function(font) {
font.objectNumber = newObject()
out('<</BaseFont/' + font.PostScriptName + '/Type/Font')
if (typeof font.encoding === 'string') {
out('/Encoding/'+font.encoding)
}
out('/Subtype/Type1>>')
out('endobj')
}
, addToFontDictionary = function(fontKey, fontName, fontStyle) {
// this is mapping structure for quick font key lookup.
// returns the KEY of the font (ex: "F1") for a given pair of font name and type (ex: "Arial". "Italic")
var undef
if (fontmap[fontName] === undef){
fontmap[fontName] = {} // fontStyle is a var interpreted and converted to appropriate string. don't wrap in quotes.
}
fontmap[fontName][fontStyle] = fontKey
}
/**
FontObject describes a particular font as member of an instnace of jsPDF
 
It's a collection of properties like 'id' (to be used in PDF stream),
'fontName' (font's family name), 'fontStyle' (font's style variant label)
 
@class
@public
@property id {String} PDF-document-instance-specific label assinged to the font.
@property PostScriptName {String} PDF specification full name for the font
@property encoding {Object} Encoding_name-to-Font_metrics_object mapping.
@name FontObject
*/
, FontObject = {}
, addFont = function(PostScriptName, fontName, fontStyle, encoding) {
var fontKey = 'F' + (getObjectLength(fonts) + 1).toString(10)
// This is FontObject
var font = fonts[fontKey] = {
'id': fontKey
// , 'objectNumber': will be set by putFont()
, 'PostScriptName': PostScriptName
, 'fontName': fontName
, 'fontStyle': fontStyle
, 'encoding': encoding
, 'metadata': {}
}
 
addToFontDictionary(fontKey, fontName, fontStyle)
 
events.publish('addFont', font)
 
return fontKey
}
, addFonts = function() {
 
var HELVETICA = "helvetica"
, TIMES = "times"
, COURIER = "courier"
, NORMAL = "normal"
, BOLD = "bold"
, ITALIC = "italic"
, BOLD_ITALIC = "bolditalic"
, encoding = 'StandardEncoding'
, standardFonts = [
['Helvetica', HELVETICA, NORMAL]
, ['Helvetica-Bold', HELVETICA, BOLD]
, ['Helvetica-Oblique', HELVETICA, ITALIC]
, ['Helvetica-BoldOblique', HELVETICA, BOLD_ITALIC]
, ['Courier', COURIER, NORMAL]
, ['Courier-Bold', COURIER, BOLD]
, ['Courier-Oblique', COURIER, ITALIC]
, ['Courier-BoldOblique', COURIER, BOLD_ITALIC]
, ['Times-Roman', TIMES, NORMAL]
, ['Times-Bold', TIMES, BOLD]
, ['Times-Italic', TIMES, ITALIC]
, ['Times-BoldItalic', TIMES, BOLD_ITALIC]
]
 
var i, l, fontKey, parts
for (i = 0, l = standardFonts.length; i < l; i++) {
fontKey = addFont(
standardFonts[i][0]
, standardFonts[i][1]
, standardFonts[i][2]
, encoding
)
 
// adding aliases for standard fonts, this time matching the capitalization
parts = standardFonts[i][0].split('-')
addToFontDictionary(fontKey, parts[0], parts[1] || '')
}
 
events.publish('addFonts', {'fonts':fonts, 'dictionary':fontmap})
}
, putResourceDictionary = function() {
out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]')
out('/Font <<')
// Do this for each font, the '1' bit is the index of the font
for (var fontKey in fonts) {
if (fonts.hasOwnProperty(fontKey)) {
out('/' + fontKey + ' ' + fonts[fontKey].objectNumber + ' 0 R')
}
}
out('>>')
out('/XObject <<')
putXobjectDict()
out('>>')
}
, putXobjectDict = function() {
// Loop through images, or other data objects
events.publish('putXobjectDict')
}
, putInfo = function() {
out('/Producer (jsPDF ' + version + ')')
if(documentProperties.title) {
out('/Title (' + pdfEscape(documentProperties.title) + ')')
}
if(documentProperties.subject) {
out('/Subject (' + pdfEscape(documentProperties.subject) + ')')
}
if(documentProperties.author) {
out('/Author (' + pdfEscape(documentProperties.author) + ')')
}
if(documentProperties.keywords) {
out('/Keywords (' + pdfEscape(documentProperties.keywords) + ')')
}
if(documentProperties.creator) {
out('/Creator (' + pdfEscape(documentProperties.creator) + ')')
}
var created = new Date()
out('/CreationDate (D:' +
[
created.getFullYear()
, padd2(created.getMonth() + 1)
, padd2(created.getDate())
, padd2(created.getHours())
, padd2(created.getMinutes())
, padd2(created.getSeconds())
].join('')+
')'
)
}
, putCatalog = function () {
out('/Type /Catalog')
out('/Pages 1 0 R')
// @TODO: Add zoom and layout modes
out('/OpenAction [3 0 R /FitH null]')
out('/PageLayout /OneColumn')
}
, putTrailer = function () {
out('/Size ' + (objectNumber + 1))
out('/Root ' + objectNumber + ' 0 R')
out('/Info ' + (objectNumber - 1) + ' 0 R')
}
, beginPage = function() {
page ++
// Do dimension stuff
outToPages = true
pages[page] = []
}
, _addPage = function() {
beginPage()
// Set line width
out(f2(lineWidth * k) + ' w')
// Set draw color
out(drawColor)
// resurrecting non-default line caps, joins
if (lineCapID !== 0) out(lineCapID.toString(10)+' J')
if (lineJoinID !== 0) out(lineJoinID.toString(10)+' j')
 
events.publish('addPage', {'pageNumber':page})
}
/**
Returns a document-specific font key - a label assigned to a
font name + font type combination at the time the font was added
to the font inventory.
 
Font key is used as label for the desired font for a block of text
to be added to the PDF document stream.
@private
@function
@param fontName {String} can be undefined on "falthy" to indicate "use current"
@param fontStyle {String} can be undefined on "falthy" to indicate "use current"
@returns {String} Font key.
*/
, getFont = function(fontName, fontStyle) {
var key, undef
 
if (fontName === undef) {
fontName = fonts[activeFontKey]['fontName']
}
if (fontStyle === undef) {
fontStyle = fonts[activeFontKey]['fontStyle']
}
 
try {
key = fontmap[fontName][fontStyle] // returns a string like 'F3' - the KEY corresponding tot he font + type combination.
} catch (e) {
key = undef
}
if (!key){
throw new Error("Unable to look up font label for font '"+fontName+"', '"+fontStyle+"'. Refer to getFontList() for available fonts.")
}
 
return key
}
, buildDocument = function() {
outToPages = false // switches out() to content
content = []
offsets = []
// putHeader()
out('%PDF-' + pdfVersion)
putPages()
putResources()
 
// Info
newObject()
out('<<')
putInfo()
out('>>')
out('endobj')
// Catalog
newObject()
out('<<')
putCatalog()
out('>>')
out('endobj')
// Cross-ref
var o = content_length
out('xref')
out('0 ' + (objectNumber + 1))
out('0000000000 65535 f ')
for (var i=1; i <= objectNumber; i++) {
out(padd10(offsets[i]) + ' 00000 n ')
}
// Trailer
out('trailer')
out('<<')
putTrailer()
out('>>')
out('startxref')
out(o)
out('%%EOF')
outToPages = true
return content.join('\n')
}
/**
@public
@function
@param text {String}
@param flags {Object} Encoding flags.
@returns {String} Encoded string
*/
, to8bitStream = function(text, flags){
/* PDF 1.3 spec:
"For text strings encoded in Unicode, the first two bytes must be 254 followed by
255, representing the Unicode byte order marker, U+FEFF. (This sequence conflicts
with the PDFDocEncoding character sequence thorn ydieresis, which is unlikely
to be a meaningful beginning of a word or phrase.) The remainder of the
string consists of Unicode character codes, according to the UTF-16 encoding
specified in the Unicode standard, version 2.0. Commonly used Unicode values
are represented as 2 bytes per character, with the high-order byte appearing first
in the string."
 
In other words, if there are chars in a string with char code above 255, we
recode the string to UCS2 BE - string doubles in length and BOM is prepended.
 
HOWEVER!
Actual *content* (body) text (as opposed to strings used in document properties etc)
does NOT expect BOM. There, it is treated as a literal GID (Glyph ID)
 
Because of Adobe's focus on "you subset your fonts!" you are not supposed to have
a font that maps directly Unicode (UCS2 / UTF16BE) code to font GID, but you could
fudge it with "Identity-H" encoding and custom CIDtoGID map that mimics Unicode
code page. There, however, all characters in the stream are treated as GIDs,
including BOM, which is the reason we need to skip BOM in content text (i.e. that
that is tied to a font).
 
To signal this "special" PDFEscape / to8bitStream handling mode,
API.text() function sets (unless you overwrite it with manual values
given to API.text(.., flags) )
flags.autoencode = true
flags.noBOM = true
 
*/
 
/*
`flags` properties relied upon:
.sourceEncoding = string with encoding label.
"Unicode" by default. = encoding of the incoming text.
pass some non-existing encoding name
(ex: 'Do not touch my strings! I know what I am doing.')
to make encoding code skip the encoding step.
.outputEncoding = Either valid PDF encoding name
(must be supported by jsPDF font metrics, otherwise no encoding)
or a JS object, where key = sourceCharCode, value = outputCharCode
missing keys will be treated as: sourceCharCode === outputCharCode
.noBOM
See comment higher above for explanation for why this is important
.autoencode
See comment higher above for explanation for why this is important
*/
 
var i, l, undef
 
if (flags === undef) {
flags = {}
}
 
var sourceEncoding = flags.sourceEncoding ? sourceEncoding : 'Unicode'
, encodingBlock
, outputEncoding = flags.outputEncoding
, newtext
, isUnicode, ch, bch
// This 'encoding' section relies on font metrics format
// attached to font objects by, among others,
// "Willow Systems' standard_font_metrics plugin"
// see jspdf.plugin.standard_font_metrics.js for format
// of the font.metadata.encoding Object.
// It should be something like
// .encoding = {'codePages':['WinANSI....'], 'WinANSI...':{code:code, ...}}
// .widths = {0:width, code:width, ..., 'fof':divisor}
// .kerning = {code:{previous_char_code:shift, ..., 'fof':-divisor},...}
if ((flags.autoencode || outputEncoding ) &&
fonts[activeFontKey].metadata &&
fonts[activeFontKey].metadata[sourceEncoding] &&
fonts[activeFontKey].metadata[sourceEncoding].encoding
) {
encodingBlock = fonts[activeFontKey].metadata[sourceEncoding].encoding
// each font has default encoding. Some have it clearly defined.
if (!outputEncoding && fonts[activeFontKey].encoding) {
outputEncoding = fonts[activeFontKey].encoding
}
 
// Hmmm, the above did not work? Let's try again, in different place.
if (!outputEncoding && encodingBlock.codePages) {
outputEncoding = encodingBlock.codePages[0] // let's say, first one is the default
}
 
if (typeof outputEncoding === 'string') {
outputEncoding = encodingBlock[outputEncoding]
}
// we want output encoding to be a JS Object, where
// key = sourceEncoding's character code and
// value = outputEncoding's character code.
if (outputEncoding) {
isUnicode = false
newtext = []
for (i = 0, l = text.length; i < l; i++) {
ch = outputEncoding[text.charCodeAt(i)]
if (ch) {
newtext.push(
String.fromCharCode(ch)
)
} else {
newtext.push(
text[i]
)
}
 
// since we are looping over chars anyway, might as well
// check for residual unicodeness
if (newtext[i].charCodeAt(0) >> 8 /* more than 255 */ ) {
isUnicode = true
}
}
text = newtext.join('')
}
}
 
i = text.length
// isUnicode may be set to false above. Hence the triple-equal to undefined
while (isUnicode === undef && i !== 0){
if ( text.charCodeAt(i - 1) >> 8 /* more than 255 */ ) {
isUnicode = true
}
;i--;
}
if (!isUnicode) {
return text
} else {
newtext = flags.noBOM ? [] : [254, 255]
for (i = 0, l = text.length; i < l; i++) {
ch = text.charCodeAt(i)
bch = ch >> 8 // divide by 256
if (bch >> 8 /* something left after dividing by 256 second time */ ) {
throw new Error("Character at position "+i.toString(10)+" of string '"+text+"' exceeds 16bits. Cannot be encoded into UCS-2 BE")
}
newtext.push(bch)
newtext.push(ch - ( bch << 8))
}
return String.fromCharCode.apply(undef, newtext)
}
}
// Replace '/', '(', and ')' with pdf-safe versions
, pdfEscape = function(text, flags) {
// doing to8bitStream does NOT make this PDF display unicode text. For that
// we also need to reference a unicode font and embed it - royal pain in the rear.
 
// There is still a benefit to to8bitStream - PDF simply cannot handle 16bit chars,
// which JavaScript Strings are happy to provide. So, while we still cannot display
// 2-byte characters property, at least CONDITIONALLY converting (entire string containing)
// 16bit chars to (USC-2-BE) 2-bytes per char + BOM streams we ensure that entire PDF
// is still parseable.
// This will allow immediate support for unicode in document properties strings.
return to8bitStream(text, flags).replace(/\\/g, '\\\\').replace(/\(/g, '\\(').replace(/\)/g, '\\)')
}
, getStyle = function(style){
// see Path-Painting Operators of PDF spec
var op = 'S'; // stroke
if (style === 'F') {
op = 'f'; // fill
} else if (style === 'FD' || style === 'DF') {
op = 'B'; // both
}
return op;
}
 
//---------------------------------------
// Public API
 
/*
Object exposing internal API to plugins
@public
*/
API.internal = {
'pdfEscape': pdfEscape
, 'getStyle': getStyle
/**
Returns {FontObject} describing a particular font.
@public
@function
@param fontName {String} (Optional) Font's family name
@param fontStyle {String} (Optional) Font's style variation name (Example:"Italic")
@returns {FontObject}
*/
, 'getFont': function(){ return fonts[getFont.apply(API, arguments)] }
, 'getFontSize': function() { return activeFontSize }
, 'btoa': btoa
, 'write': function(string1, string2, string3, etc){
out(
arguments.length === 1?
arguments[0] :
Array.prototype.join.call(arguments, ' ')
)
}
, 'getCoordinateString': function(value){
return f2(value * k)
}
, 'getVerticalCoordinateString': function(value){
return f2((pageHeight - value) * k)
}
, 'collections': {}
, 'newObject': newObject
, 'putStream': putStream
, 'events': events
// ratio that you use in multiplication of a given "size" number to arrive to 'point'
// units of measurement.
// scaleFactor is set at initialization of the document and calculated against the stated
// default measurement units for the document.
// If default is "mm", k is the number that will turn number in 'mm' into 'points' number.
// through multiplication.
, 'scaleFactor': k
, 'pageSize': {'width':pageWidth, 'height':pageHeight}
, 'output': function(type, options) {
return output(type, options);
}
}
/**
Adds (and transfers the focus to) new page to the PDF document.
@function
@returns {jsPDF}
 
@methodOf jsPDF#
@name addPage
*/
API.addPage = function() {
_addPage()
return this
}
 
/**
Adds text to page. Supports adding multiline text when 'text' argument is an Array of Strings.
@function
@param {String|Array} text String or array of strings to be added to the page. Each line is shifted one line down per font, spacing settings declared before this call.
@param {Number} x Coordinate (in units declared at inception of PDF document) against left edge of the page
@param {Number} y Coordinate (in units declared at inception of PDF document) against upper edge of the page
@param {Object} flags Collection of settings signalling how the text must be encoded. Defaults are sane. If you think you want to pass some flags, you likely can read the source.
@returns {jsPDF}
@methodOf jsPDF#
@name text
*/
API.text = function(text, x, y, flags) {
/**
* Inserts something like this into PDF
BT
/F1 16 Tf % Font name + size
16 TL % How many units down for next line in multiline text
0 g % color
28.35 813.54 Td % position
(line one) Tj
T* (line two) Tj
T* (line three) Tj
ET
*/
var undef
// Pre-August-2012 the order of arguments was function(x, y, text, flags)
// in effort to make all calls have similar signature like
// function(data, coordinates... , miscellaneous)
// this method had its args flipped.
// code below allows backward compatibility with old arg order.
var _first, _second, _third
if (typeof arguments[0] === 'number') {
_first = arguments[2]
_second = arguments[0]
_third = arguments[1]
 
text = _first
x = _second
y = _third
}
 
// If there are any newlines in text, we assume
// the user wanted to print multiple lines, so break the
// text up into an array. If the text is already an array,
// we assume the user knows what they are doing.
if (typeof text === 'string' && text.match(/[\n\r]/)) {
text = text.split(/\r\n|\r|\n/g)
}
 
if (typeof flags === 'undefined') {
flags = {'noBOM':true,'autoencode':true}
} else {
 
if (flags.noBOM === undef) {
flags.noBOM = true
}
 
if (flags.autoencode === undef) {
flags.autoencode = true
}
 
}
 
var newtext, str
 
if (typeof text === 'string') {
str = pdfEscape(text, flags)
} else if (text instanceof Array) /* Array */{
// we don't want to destroy original text array, so cloning it
newtext = text.concat()
// we do array.join('text that must not be PDFescaped")
// thus, pdfEscape each component separately
for ( var i = newtext.length - 1; i !== -1 ; i--) {
newtext[i] = pdfEscape( newtext[i], flags)
}
str = newtext.join( ") Tj\nT* (" )
} else {
throw new Error('Type of text must be string or Array. "'+text+'" is not recognized.')
}
// Using "'" ("go next line and render text" mark) would save space but would complicate our rendering code, templates
// BT .. ET does NOT have default settings for Tf. You must state that explicitely every time for BT .. ET
// if you want text transformation matrix (+ multiline) to work reliably (which reads sizes of things from font declarations)
// Thus, there is NO useful, *reliable* concept of "default" font for a page.
// The fact that "default" (reuse font used before) font worked before in basic cases is an accident
// - readers dealing smartly with brokenness of jsPDF's markup.
out(
'BT\n/' +
activeFontKey + ' ' + activeFontSize + ' Tf\n' + // font face, style, size
activeFontSize + ' TL\n' + // line spacing
textColor +
'\n' + f2(x * k) + ' ' + f2((pageHeight - y) * k) + ' Td\n(' +
str +
') Tj\nET'
)
return this
}
 
API.line = function(x1, y1, x2, y2) {
out(
f2(x1 * k) + ' ' + f2((pageHeight - y1) * k) + ' m ' +
f2(x2 * k) + ' ' + f2((pageHeight - y2) * k) + ' l S'
)
return this
}
 
/**
Adds series of curves (straight lines or cubic bezier curves) to canvas, starting at `x`, `y` coordinates.
All data points in `lines` are relative to last line origin.
`x`, `y` become x1,y1 for first line / curve in the set.
For lines you only need to specify [x2, y2] - (ending point) vector against x1, y1 starting point.
For bezier curves you need to specify [x2,y2,x3,y3,x4,y4] - vectors to control points 1, 2, ending point. All vectors are against the start of the curve - x1,y1.
@example .lines([[2,2],[-2,2],[1,1,2,2,3,3],[2,1]], 212,110, 10) // line, line, bezier curve, line
@param {Array} lines Array of *vector* shifts as pairs (lines) or sextets (cubic bezier curves).
@param {Number} x Coordinate (in units declared at inception of PDF document) against left edge of the page
@param {Number} y Coordinate (in units declared at inception of PDF document) against upper edge of the page
@param {Number} scale (Defaults to [1.0,1.0]) x,y Scaling factor for all vectors. Elements can be any floating number Sub-one makes drawing smaller. Over-one grows the drawing. Negative flips the direction.
@function
@returns {jsPDF}
@methodOf jsPDF#
@name lines
*/
API.lines = function(lines, x, y, scale, style) {
var undef
// Pre-August-2012 the order of arguments was function(x, y, lines, scale, style)
// in effort to make all calls have similar signature like
// function(content, coordinateX, coordinateY , miscellaneous)
// this method had its args flipped.
// code below allows backward compatibility with old arg order.
var _first, _second, _third
if (typeof arguments[0] === 'number') {
_first = arguments[2]
_second = arguments[0]
_third = arguments[1]
 
lines = _first
x = _second
y = _third
}
 
style = getStyle(style)
scale = scale === undef ? [1,1] : scale
 
// starting point
out(f3(x * k) + ' ' + f3((pageHeight - y) * k) + ' m ')
var scalex = scale[0]
, scaley = scale[1]
, i = 0
, l = lines.length
, leg
, x2, y2 // bezier only. In page default measurement "units", *after* scaling
, x3, y3 // bezier only. In page default measurement "units", *after* scaling
// ending point for all, lines and bezier. . In page default measurement "units", *after* scaling
, x4 = x // last / ending point = starting point for first item.
, y4 = y // last / ending point = starting point for first item.
for (; i < l; i++) {
leg = lines[i]
if (leg.length === 2){
// simple line
x4 = leg[0] * scalex + x4 // here last x4 was prior ending point
y4 = leg[1] * scaley + y4 // here last y4 was prior ending point
out(f3(x4 * k) + ' ' + f3((pageHeight - y4) * k) + ' l')
} else {
// bezier curve
x2 = leg[0] * scalex + x4 // here last x4 is prior ending point
y2 = leg[1] * scaley + y4 // here last y4 is prior ending point
x3 = leg[2] * scalex + x4 // here last x4 is prior ending point
y3 = leg[3] * scaley + y4 // here last y4 is prior ending point
x4 = leg[4] * scalex + x4 // here last x4 was prior ending point
y4 = leg[5] * scaley + y4 // here last y4 was prior ending point
out(
f3(x2 * k) + ' ' +
f3((pageHeight - y2) * k) + ' ' +
f3(x3 * k) + ' ' +
f3((pageHeight - y3) * k) + ' ' +
f3(x4 * k) + ' ' +
f3((pageHeight - y4) * k) + ' c'
)
}
}
// stroking / filling / both the path
out(style)
return this
}
 
/**
Adds a rectangle to PDF
@param {Number} x Coordinate (in units declared at inception of PDF document) against left edge of the page
@param {Number} y Coordinate (in units declared at inception of PDF document) against upper edge of the page
@param {Number} w Width (in units declared at inception of PDF document)
@param {Number} h Height (in units declared at inception of PDF document)
@param {String} style (Defaults to active fill/stroke style) A string signalling if stroke, fill or both are to be applied.
@function
@returns {jsPDF}
@methodOf jsPDF#
@name rect
*/
API.rect = function(x, y, w, h, style) {
var op = getStyle(style)
out([
f2(x * k)
, f2((pageHeight - y) * k)
, f2(w * k)
, f2(-h * k)
, 're'
, op
].join(' '))
return this
}
 
/**
Adds a triangle to PDF
@param {Number} x1 Coordinate (in units declared at inception of PDF document) against left edge of the page
@param {Number} y1 Coordinate (in units declared at inception of PDF document) against upper edge of the page
@param {Number} x2 Coordinate (in units declared at inception of PDF document) against left edge of the page
@param {Number} y2 Coordinate (in units declared at inception of PDF document) against upper edge of the page
@param {Number} x3 Coordinate (in units declared at inception of PDF document) against left edge of the page
@param {Number} y3 Coordinate (in units declared at inception of PDF document) against upper edge of the page
@param {String} style (Defaults to active fill/stroke style) A string signalling if stroke, fill or both are to be applied.
@function
@returns {jsPDF}
@methodOf jsPDF#
@name triangle
*/
API.triangle = function(x1, y1, x2, y2, x3, y3, style) {
this.lines(
[
[ x2 - x1 , y2 - y1 ] // vector to point 2
, [ x3 - x2 , y3 - y2 ] // vector to point 3
, [ x1 - x3 , y1 - y3 ] // closing vector back to point 1
]
, x1, y1 // start of path
, [1,1]
, style
)
return this;
}
/**
Adds a rectangle with rounded corners to PDF
@param {Number} x Coordinate (in units declared at inception of PDF document) against left edge of the page
@param {Number} y Coordinate (in units declared at inception of PDF document) against upper edge of the page
@param {Number} w Width (in units declared at inception of PDF document)
@param {Number} h Height (in units declared at inception of PDF document)
@param {Number} rx Radius along x axis (in units declared at inception of PDF document)
@param {Number} rx Radius along y axis (in units declared at inception of PDF document)
@param {String} style (Defaults to active fill/stroke style) A string signalling if stroke, fill or both are to be applied.
@function
@returns {jsPDF}
@methodOf jsPDF#
@name roundedRect
*/
API.roundedRect = function(x, y, w, h, rx, ry, style) {
var MyArc = 4/3*(Math.SQRT2-1);
this.lines(
[
[ (w-2*rx), 0 ]
, [ (rx*MyArc), 0, rx, ry-(ry*MyArc), rx, ry ]
, [ 0, (h-2*ry) ]
, [ 0, (ry*MyArc), -(rx*MyArc), ry, -rx, ry]
, [ (-w+2*rx), 0]
, [ -(rx*MyArc), 0, -rx, -(ry*MyArc), -rx, -ry]
, [ 0, (-h+2*ry)]
, [ 0, -(ry*MyArc), (rx*MyArc), -ry, rx, -ry]
]
, x+rx, y // start of path
, [1,1]
, style
)
return this;
}
 
/**
Adds an ellipse to PDF
@param {Number} x Coordinate (in units declared at inception of PDF document) against left edge of the page
@param {Number} y Coordinate (in units declared at inception of PDF document) against upper edge of the page
@param {Number} rx Radius along x axis (in units declared at inception of PDF document)
@param {Number} rx Radius along y axis (in units declared at inception of PDF document)
@param {String} style (Defaults to active fill/stroke style) A string signalling if stroke, fill or both are to be applied.
@function
@returns {jsPDF}
@methodOf jsPDF#
@name ellipse
*/
API.ellipse = function(x, y, rx, ry, style) {
var op = getStyle(style)
, lx = 4/3*(Math.SQRT2-1)*rx
, ly = 4/3*(Math.SQRT2-1)*ry
out([
f2((x+rx)*k)
, f2((pageHeight-y)*k)
, 'm'
, f2((x+rx)*k)
, f2((pageHeight-(y-ly))*k)
, f2((x+lx)*k)
, f2((pageHeight-(y-ry))*k)
, f2(x*k)
, f2((pageHeight-(y-ry))*k)
, 'c'
].join(' '))
out([
f2((x-lx)*k)
, f2((pageHeight-(y-ry))*k)
, f2((x-rx)*k)
, f2((pageHeight-(y-ly))*k)
, f2((x-rx)*k)
, f2((pageHeight-y)*k)
, 'c'
].join(' '))
out([
f2((x-rx)*k)
, f2((pageHeight-(y+ly))*k)
, f2((x-lx)*k)
, f2((pageHeight-(y+ry))*k)
, f2(x*k)
, f2((pageHeight-(y+ry))*k)
, 'c'
].join(' '))
out([
f2((x+lx)*k)
, f2((pageHeight-(y+ry))*k)
, f2((x+rx)*k)
, f2((pageHeight-(y+ly))*k)
, f2((x+rx)*k)
, f2((pageHeight-y)*k)
,'c'
, op
].join(' '))
return this
}
 
/**
Adds an circle to PDF
@param {Number} x Coordinate (in units declared at inception of PDF document) against left edge of the page
@param {Number} y Coordinate (in units declared at inception of PDF document) against upper edge of the page
@param {Number} r Radius (in units declared at inception of PDF document)
@param {String} style (Defaults to active fill/stroke style) A string signalling if stroke, fill or both are to be applied.
@function
@returns {jsPDF}
@methodOf jsPDF#
@name circle
*/
API.circle = function(x, y, r, style) {
return this.ellipse(x, y, r, r, style)
}
 
/**
Adds a properties to the PDF document
@param {Object} A property_name-to-property_value object structure.
@function
@returns {jsPDF}
@methodOf jsPDF#
@name setProperties
*/
API.setProperties = function(properties) {
// copying only those properties we can render.
for (var property in documentProperties){
if (documentProperties.hasOwnProperty(property) && properties[property]) {
documentProperties[property] = properties[property]
}
}
return this
}
 
/**
Sets font size for upcoming text elements.
@param {Number} size Font size in points.
@function
@returns {jsPDF}
@methodOf jsPDF#
@name setFontSize
*/
API.setFontSize = function(size) {
activeFontSize = size
return this
}
 
/**
Sets text font face, variant for upcoming text elements.
See output of jsPDF.getFontList() for possible font names, styles.
@param {String} fontName Font name or family. Example: "times"
@param {String} fontStyle Font style or variant. Example: "italic"
@function
@returns {jsPDF}
@methodOf jsPDF#
@name setFont
*/
API.setFont = function(fontName, fontStyle) {
activeFontKey = getFont(fontName, fontStyle)
// if font is not found, the above line blows up and we never go further
return this
}
 
/**
Switches font style or variant for upcoming text elements,
while keeping the font face or family same.
See output of jsPDF.getFontList() for possible font names, styles.
@param {String} style Font style or variant. Example: "italic"
@function
@returns {jsPDF}
@methodOf jsPDF#
@name setFontStyle
*/
API.setFontStyle = API.setFontType = function(style) {
var undef
activeFontKey = getFont(undef, style)
// if font is not found, the above line blows up and we never go further
return this
}
 
/**
Returns an object - a tree of fontName to fontStyle relationships available to
active PDF document.
 
@public
@function
@returns {Object} Like {'times':['normal', 'italic', ... ], 'arial':['normal', 'bold', ... ], ... }
@methodOf jsPDF#
@name getFontList
*/
API.getFontList = function(){
// TODO: iterate over fonts array or return copy of fontmap instead in case more are ever added.
var list = {}
, fontName
, fontStyle
, tmp
 
for (fontName in fontmap) {
if (fontmap.hasOwnProperty(fontName)) {
list[fontName] = tmp = []
for (fontStyle in fontmap[fontName]){
if (fontmap[fontName].hasOwnProperty(fontStyle)) {
tmp.push(fontStyle)
}
}
}
}
 
return list
}
 
/**
Sets line width for upcoming lines.
@param {Number} width Line width (in units declared at inception of PDF document)
@function
@returns {jsPDF}
@methodOf jsPDF#
@name setLineWidth
*/
API.setLineWidth = function(width) {
out((width * k).toFixed(2) + ' w')
return this
}
 
/**
Sets the stroke color for upcoming elements.
 
Depending on the number of arguments given, Gray, RGB, or CMYK
color space is implied.
 
When only ch1 is given, "Gray" color space is implied and it
must be a value in the range from 0.00 (solid black) to to 1.00 (white)
if values are communicated as String types, or in range from 0 (black)
to 255 (white) if communicated as Number type.
The RGB-like 0-255 range is provided for backward compatibility.
 
When only ch1,ch2,ch3 are given, "RGB" color space is implied and each
value must be in the range from 0.00 (minimum intensity) to to 1.00
(max intensity) if values are communicated as String types, or
from 0 (min intensity) to to 255 (max intensity) if values are communicated
as Number types.
The RGB-like 0-255 range is provided for backward compatibility.
 
When ch1,ch2,ch3,ch4 are given, "CMYK" color space is implied and each
value must be a in the range from 0.00 (0% concentration) to to
1.00 (100% concentration)
 
Because JavaScript treats fixed point numbers badly (rounds to
floating point nearest to binary representation) it is highly advised to
communicate the fractional numbers as String types, not JavaScript Number type.
@param {Number|String} ch1 Color channel value
@param {Number|String} ch2 Color channel value
@param {Number|String} ch3 Color channel value
@param {Number|String} ch4 Color channel value
 
@function
@returns {jsPDF}
@methodOf jsPDF#
@name setDrawColor
*/
API.setDrawColor = function(ch1,ch2,ch3,ch4) {
var undefined
, color
if (ch2 === undefined || ( ch4 === undefined && ch1 === ch2 === ch3 ) ) {
// Gray color space.
if (typeof ch1 === 'string') {
color = ch1 + ' G'
} else {
color = f2(ch1/255) + ' G'
}
} else if (ch4 === undefined) {
// RGB
if (typeof ch1 === 'string') {
color = [ch1, ch2, ch3, 'RG'].join(' ')
} else {
color = [f2(ch1/255), f2(ch2/255), f2(ch3/255), 'RG'].join(' ')
}
} else {
// CMYK
if (typeof ch1 === 'string') {
color = [ch1, ch2, ch3, ch4, 'K'].join(' ')
} else {
color = [f2(ch1), f2(ch2), f2(ch3), f2(ch4), 'K'].join(' ')
}
}
 
out(color)
return this
}
 
/**
Sets the fill color for upcoming elements.
Depending on the number of arguments given, Gray, RGB, or CMYK
color space is implied.
 
When only ch1 is given, "Gray" color space is implied and it
must be a value in the range from 0.00 (solid black) to to 1.00 (white)
if values are communicated as String types, or in range from 0 (black)
to 255 (white) if communicated as Number type.
The RGB-like 0-255 range is provided for backward compatibility.
 
When only ch1,ch2,ch3 are given, "RGB" color space is implied and each
value must be in the range from 0.00 (minimum intensity) to to 1.00
(max intensity) if values are communicated as String types, or
from 0 (min intensity) to to 255 (max intensity) if values are communicated
as Number types.
The RGB-like 0-255 range is provided for backward compatibility.
 
When ch1,ch2,ch3,ch4 are given, "CMYK" color space is implied and each
value must be a in the range from 0.00 (0% concentration) to to
1.00 (100% concentration)
 
Because JavaScript treats fixed point numbers badly (rounds to
floating point nearest to binary representation) it is highly advised to
communicate the fractional numbers as String types, not JavaScript Number type.
@param {Number|String} ch1 Color channel value
@param {Number|String} ch2 Color channel value
@param {Number|String} ch3 Color channel value
@param {Number|String} ch4 Color channel value
 
@function
@returns {jsPDF}
@methodOf jsPDF#
@name setFillColor
*/
API.setFillColor = function(ch1, ch2, ch3, ch4) {
var undefined
, color
 
if (ch2 === undefined || ( ch4 === undefined && ch1 === ch2 === ch3 ) ) {
// Gray color space.
if (typeof ch1 === 'string') {
color = ch1 + ' g'
} else {
color = f2(r/255) + ' g'
}
} else if (ch4 === undefined) {
// RGB
if (typeof ch1 === 'string') {
color = [ch1, ch2, ch3, 'rg'].join(' ')
} else {
color = [f2(ch1/255), f2(ch2/255), f2(ch3/255), 'rg'].join(' ')
}
} else {
// CMYK
if (typeof ch1 === 'string') {
color = [ch1, ch2, ch3, ch4, 'k'].join(' ')
} else {
color = [f2(ch1), f2(ch2), f2(ch3), f2(ch4), 'k'].join(' ')
}
}
 
out(color)
return this
}
 
/**
Sets the text color for upcoming elements.
If only one, first argument is given,
treats the value as gray-scale color value.
@param {Number} r Red channel color value in range 0-255
@param {Number} g Green channel color value in range 0-255
@param {Number} b Blue channel color value in range 0-255
@function
@returns {jsPDF}
@methodOf jsPDF#
@name setTextColor
*/
API.setTextColor = function(r,g,b) {
if ((r===0 && g===0 && b===0) || (typeof g === 'undefined')) {
textColor = f3(r/255) + ' g'
} else {
textColor = [f3(r/255), f3(g/255), f3(b/255), 'rg'].join(' ')
}
return this
}
 
/**
Is an Object providing a mapping from human-readable to
integer flag values designating the varieties of line cap
and join styles.
@returns {Object}
@fieldOf jsPDF#
@name CapJoinStyles
*/
API.CapJoinStyles = {
0:0, 'butt':0, 'but':0, 'bevel':0
, 1:1, 'round': 1, 'rounded':1, 'circle':1
, 2:2, 'projecting':2, 'project':2, 'square':2, 'milter':2
}
 
/**
Sets the line cap styles
See {jsPDF.CapJoinStyles} for variants
@param {String|Number} style A string or number identifying the type of line cap
@function
@returns {jsPDF}
@methodOf jsPDF#
@name setLineCap
*/
API.setLineCap = function(style) {
var undefined
, id = this.CapJoinStyles[style]
if (id === undefined) {
throw new Error("Line cap style of '"+style+"' is not recognized. See or extend .CapJoinStyles property for valid styles")
}
lineCapID = id
out(id.toString(10) + ' J')
 
return this
}
 
/**
Sets the line join styles
See {jsPDF.CapJoinStyles} for variants
@param {String|Number} style A string or number identifying the type of line join
@function
@returns {jsPDF}
@methodOf jsPDF#
@name setLineJoin
*/
API.setLineJoin = function(style) {
var undefined
, id = this.CapJoinStyles[style]
if (id === undefined) {
throw new Error("Line join style of '"+style+"' is not recognized. See or extend .CapJoinStyles property for valid styles")
}
lineJoinID = id
out(id.toString(10) + ' j')
 
return this
}
 
/**
Generates the PDF document.
Possible values:
datauristring (alias dataurlstring) - Data-Url-formatted data returned as string.
datauri (alias datauri) - Data-Url-formatted data pushed into current window's location (effectively reloading the window with contents of the PDF).
If `type` argument is undefined, output is raw body of resulting PDF returned as a string.
 
@param {String} type A string identifying one of the possible output types.
@param {Object} options An object providing some additional signalling to PDF generator.
@function
@returns {jsPDF}
@methodOf jsPDF#
@name output
*/
var output = function(type, options) {
var undef
switch (type){
case undef:
return buildDocument();
case 'save':
 
// If Safari - fallback to Data URL, sorry there's no way to feature detect this
// @TODO: Refactor this
$.browser.chrome = $.browser.webkit && !!window.chrome;
$.browser.safari = $.browser.webkit && !window.chrome;
 
// Open in new window if webkit, until the BlobBuilder is fixed
// Seems to have been removed in Chrome 24
if ($.browser.webkit) {
return API.output('dataurlnewwindow');
}
 
var bb = new BlobBuilder;
var data = buildDocument();
 
// Need to add the file to BlobBuilder as a Uint8Array
var length = data.length;
var array = new Uint8Array(new ArrayBuffer(length));
 
for (var i = 0; i < length; i++) {
array[i] = data.charCodeAt(i);
}
 
bb.append(array);
 
var blob = bb.getBlob('application/pdf');
saveAs(blob, options);
break;
case 'datauristring':
case 'dataurlstring':
return 'data:application/pdf;base64,' + btoa(buildDocument())
case 'datauri':
case 'dataurl':
document.location.href = 'data:application/pdf;base64,' + btoa(buildDocument()); break;
break;
case 'dataurlnewwindow':
window.open('data:application/pdf;base64,' + btoa(buildDocument()));
break;
default: throw new Error('Output type "'+type+'" is not supported.')
}
// @TODO: Add different output options
};
 
// Output is both an internal (for plugins) and external function
API.output = output;
 
/**
* Saves as PDF document. An alias of jsPDF.output('save', 'filename.pdf')
* @param {String} filename The filename including extension.
*
* @function
* @returns {jsPDF}
* @methodOf jsPDF#
* @name save
*/
API.save = function(filename) {
API.output('save', filename);
}
 
// applying plugins (more methods) ON TOP of built-in API.
// this is intentional as we allow plugins to override
// built-ins
for (var plugin in jsPDF.API){
if (jsPDF.API.hasOwnProperty(plugin)){
if (plugin === 'events' && jsPDF.API.events.length) {
(function(events, newEvents){
 
// jsPDF.API.events is a JS Array of Arrays
// where each Array is a pair of event name, handler
// Events were added by plugins to the jsPDF instantiator.
// These are always added to the new instance and some ran
// during instantiation.
 
var eventname, handler_and_args
 
for (var i = newEvents.length - 1; i !== -1; i--){
// subscribe takes 3 args: 'topic', function, runonce_flag
// if undefined, runonce is false.
// users can attach callback directly,
// or they can attach an array with [callback, runonce_flag]
// that's what the "apply" magic is for below.
eventname = newEvents[i][0]
handler_and_args = newEvents[i][1]
events.subscribe.apply(
events
, [eventname].concat(
typeof handler_and_args === 'function' ?
[ handler_and_args ] :
handler_and_args
)
)
}
})(events, jsPDF.API.events)
} else {
API[plugin] = jsPDF.API[plugin]
}
}
}
 
/////////////////////////////////////////
// continuing initilisation of jsPDF Document object
/////////////////////////////////////////
 
 
// Add the first page automatically
addFonts()
activeFontKey = 'F1'
_addPage()
 
events.publish('initialized')
 
return API
}
 
/**
jsPDF.API is a STATIC property of jsPDF class.
jsPDF.API is an object you can add methods and properties to.
The methods / properties you add will show up in new jsPDF objects.
 
One property is prepopulated. It is the 'events' Object. Plugin authors can add topics, callbacks to this object. These will be reassigned to all new instances of jsPDF.
Examples:
jsPDF.API.events['initialized'] = function(){ 'this' is API object }
jsPDF.API.events['addFont'] = function(added_font_object){ 'this' is API object }
 
@static
@public
@memberOf jsPDF
@name API
 
@example
jsPDF.API.mymethod = function(){
// 'this' will be ref to internal API object. see jsPDF source
// , so you can refer to built-in methods like so:
// this.line(....)
// this.text(....)
}
var pdfdoc = new jsPDF()
pdfdoc.mymethod() // <- !!!!!!
*/
jsPDF.API = {'events':[]}
 
return jsPDF
})()

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.