////////////////////////////////////////////////////////////////////
        // Create article's example test PDF document
        ////////////////////////////////////////////////////////////////////

        public static void GenerateWelcomeLetterSimple(String FileName, CustomerInformation customer, List <Account> accountList, BranchInfo branch, bool inclEmail, Boolean Debug = false)
        {
            // Create an empty pdf document in A4 and measured in cm
            bool landscape = false;

            document = new PdfDocument(PaperType.A4, landscape, UnitOfMeasure.cm, FileName);

            // Set debug tag
            document.Debug = Debug;

            // Write Pdf info
            PdfInfo Info = PdfInfo.CreatePdfInfo(document);

            Info.Title("Welcome Letter - Bank of China");
            Info.Author("Bank of China " + branch.GetAddress()[0]);
            Info.Keywords("Account, Bank of China, Remittance");
            Info.Subject("Remittance information for Bank of China accounts");

            // define font resources
            DefineFontResources();

            // Add first page, also the only page for simple welcome letter
            Page = new PdfPage(document);

            // Add contents to page
            Contents = new PdfContents(Page);

            // Add graphices and text contents to the contents object
            DrawTitle();
            if (customer.HasAddress())
            {
                DrawCustomerNameAddress(customer);
            }
            DrawBranchNameAddress(branch, inclEmail);
            DrawLetterGreeting(customer);
            DrawBankInformation(customer);
            DrawAccountInformationForm(accountList);
            DrawLetterBody();
            DrawGroupContact();

            // Create pdf file
            document.CreateFile();

            // exit
            return;
        }
예제 #2
0
        ////////////////////////////////////////////////////////////////////
        // Create article's example test PDF document
        ////////////////////////////////////////////////////////////////////

        public void Test
        (
            Boolean Debug,
            String FileName
        )
        {
            // Step 1: Create empty document
            // Arguments: page width: 8.5”, page height: 11”, Unit of measure: inches
            // Return value: PdfDocument main class
            Document = new PdfDocument(PaperType.Letter, false, UnitOfMeasure.Inch, FileName);

            // for encryption test
//		Document.SetEncryption(null, null, Permission.All & ~Permission.Print, EncryptionType.Aes128);

            // Debug property
            // By default it is set to false. Use it for debugging only.
            // If this flag is set, PDF objects will not be compressed, font and images will be replaced
            // by text place holder. You can view the file with a text editor but you cannot open it with PDF reader.
            Document.Debug = Debug;

            PdfInfo Info = PdfInfo.CreatePdfInfo(Document);

            Info.Title("Article Example");
            Info.Author("Uzi Granot Granotech Limited");
            Info.Keywords("PDF, .NET, C#, Library, Document Creator");
            Info.Subject("PDF File Writer C# Class Library (Version 1.14.1)");

            // Step 2: create resources
            // define font resources
            DefineFontResources();

            // define tiling pattern resources
            DefineTilingPatternResource();

            // Step 3: Add new page
            Page = new PdfPage(Document);

            // Step 4:Add contents to page
            Contents = new PdfContents(Page);

            // Step 5: add graphices and text contents to the contents object
            DrawFrameAndBackgroundWaterMark();
            DrawTwoLinesOfHeading();
            DrawHappyFace();
            DrawBarcode();
            DrawBrickPattern();
            DrawImage();
            DrawHeart();
            DrawChart();
            DrawTextBox();
            DrawBookOrderForm();

            // Step 6: create pdf file
            Document.CreateFile();

            // start default PDF reader and display the file
            Process Proc = new Process();

            Proc.StartInfo = new ProcessStartInfo(FileName);
            Proc.Start();

            // exit
            return;
        }