当前位置: 首页>>代码示例>>C#>>正文


C# text.List类代码示例

本文整理汇总了C#中iTextSharp.text.List的典型用法代码示例。如果您正苦于以下问题:C# List类的具体用法?C# List怎么用?C# List使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


List类属于iTextSharp.text命名空间,在下文中一共展示了List类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreatePdf

        public override byte[] CreatePdf(List<PdfContentParameter> contents, string[] images, int type)
        {
            var document = new Document();
            float docHeight = document.PageSize.Height - heightOffset;
            document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
            document.SetMargins(50, 50, 10, 40);

            var output = new MemoryStream();
            var writer = PdfWriter.GetInstance(document, output);

            writer.PageEvent = new HeaderFooterHandler(type);

            document.Open();

            document.Add(contents[0].Table);

            for (int i = 0; i < images.Length; i++)
            {
                document.NewPage();
                float subtrahend = document.PageSize.Height - heightOffset;
                iTextSharp.text.Image pool = iTextSharp.text.Image.GetInstance(images[i]);
                pool.Alignment = 3;
                pool.ScaleToFit(document.PageSize.Width - (document.RightMargin * 2), subtrahend);
                //pool.ScaleAbsolute(document.PageSize.Width - (document.RightMargin * 2), subtrahend);
                document.Add(pool);
            }

            document.Close();
            return output.ToArray();
        }
开发者ID:meanprogrammer,项目名称:sawebreports_migrated,代码行数:30,代码来源:GenericPDFBuilderStrategy.cs

示例2: Content

        /*
         * (non-Javadoc)
         *
         * @see
         * com.itextpdf.tool.xml.ITagProcessor#content(com.itextpdf.tool.xml.Tag,
         * java.util.List, com.itextpdf.text.Document, java.lang.String)
         */
        public override IList<IElement> Content(IWorkerContext ctx, Tag tag, String content) {
            List<Chunk> sanitizedChunks = HTMLUtils.Sanitize(content, false);
		    List<IElement> l = new List<IElement>(1);
            foreach (Chunk sanitized in sanitizedChunks) {
                HtmlPipelineContext myctx;
                try {
                    myctx = GetHtmlPipelineContext(ctx);
                } catch (NoCustomContextException e) {
                    throw new RuntimeWorkerException(e);
                }
                if (tag.CSS.ContainsKey(CSS.Property.TAB_INTERVAL)) {
                    TabbedChunk tabbedChunk = new TabbedChunk(sanitized.Content);
                    if (null != GetLastChild(tag) && GetLastChild(tag).CSS.ContainsKey(CSS.Property.XFA_TAB_COUNT)) {
                        tabbedChunk.TabCount = int.Parse(GetLastChild(tag).CSS[CSS.Property.XFA_TAB_COUNT]);
                    }
                    l.Add(GetCssAppliers().Apply(tabbedChunk, tag,myctx));
                } else if (null != GetLastChild(tag) && GetLastChild(tag).CSS.ContainsKey(CSS.Property.XFA_TAB_COUNT)) {
                    TabbedChunk tabbedChunk = new TabbedChunk(sanitized.Content);
                    tabbedChunk.TabCount = int.Parse(GetLastChild(tag).CSS[CSS.Property.XFA_TAB_COUNT]);
                    l.Add(GetCssAppliers().Apply(tabbedChunk, tag, myctx));
                } else {
                    l.Add(GetCssAppliers().Apply(sanitized, tag, myctx));
                }
            }
            return l;
        }
开发者ID:smartleos,项目名称:itextsharp,代码行数:33,代码来源:ParaGraph.cs

示例3: Assemble

        private void Assemble()
        {
            //headers
            document.Add(makeHeader("DISCUSSION SUPPORT SYSTEM"));
            document.Add(makeHeader("Discussion report"));

            InsertLine();

            //subject
            document.Add(makeHeader(discussion.Subject, true));

            InsertLine();

            //background
            Paragraph p = new Paragraph();
            ///p.Add(TextRefsAggregater.PlainifyRichText(discussion.Background));
            p.Add(new Chunk("\n"));
            document.Add(p);

            InsertLine();

            //sources
            backgroundSources();
            document.NewPage();

            //agreement blocks
            List<ArgPoint> agreed = new List<ArgPoint>();
            List<ArgPoint> disagreed = new List<ArgPoint>();
            List<ArgPoint> unsolved = new List<ArgPoint>();
            addBlockOfAgreement("Agreed", agreed);
            addBlockOfAgreement("Disagreed", disagreed);
            addBlockOfAgreement("Unsolved", unsolved);
        }
开发者ID:gdlprj,项目名称:duscusys,代码行数:33,代码来源:ReportGenerator.cs

示例4: GeneratePdfSingleDataType

 public static void GeneratePdfSingleDataType(string filePath, string title, List<string> content)
 {
     try
     {
         Logger.LogI("GeneratePDF -> " + filePath);
         var doc = new Document(PageSize.A3, 36, 72, 72, 144);
         using (var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
         {
             PdfWriter.GetInstance(doc, fs);
             doc.Open();
             doc.AddTitle(title);
             doc.AddAuthor(Environment.MachineName);
             doc.Add(
                 new Paragraph("Title : " + title + Environment.NewLine + "ServerName : " +
                               Environment.MachineName +
                               Environment.NewLine + "Author : " + Environment.UserName));
             foreach (var para in content)
             {
                 doc.NewPage();
                 doc.Add(new Paragraph(para));
             }
             doc.Close();
         }
         //ApplyWaterMark(filePath);
     }
     catch (Exception ex)
     {
         Logger.LogE(ex.Source + " -> " + ex.Message + "\n" + ex.StackTrace);
     }
 }
开发者ID:abhimanbhau,项目名称:ScrapEra,代码行数:30,代码来源:PdfGenerator.cs

示例5: End

        /* (non-Javadoc)
         * @see com.itextpdf.tool.xml.ITagProcessor#endElement(com.itextpdf.tool.xml.Tag, java.util.List, com.itextpdf.text.Document)
         */
        public override IList<IElement> End(IWorkerContext ctx, Tag tag, IList<IElement> currentContent) {
            List<IElement> l = new List<IElement>(1);
            if (currentContent.Count > 0) {
                IList<IElement> currentContentToParagraph = CurrentContentToParagraph(currentContent, true, true, tag, ctx);
                foreach (IElement p in currentContentToParagraph) {
                    ((Paragraph) p).Role = (getHeaderRole(GetLevel(tag)));
                }
                ParentTreeUtil pt = new ParentTreeUtil();
                try {
                    HtmlPipelineContext context = GetHtmlPipelineContext(ctx);
                    
                    bool oldBookmark = context.AutoBookmark();
                    if (pt.GetParentTree(tag).Contains(HTML.Tag.TD))
                        context.AutoBookmark(false);

                    if (context.AutoBookmark()) {
                        Paragraph title = new Paragraph();
                        foreach (IElement w in currentContentToParagraph) {
                                title.Add(w);
                        }

                        l.Add(new WriteH(context, tag, this, title));
                    }

                    context.AutoBookmark(oldBookmark);
                } catch (NoCustomContextException e) {
                    if (LOGGER.IsLogging(Level.ERROR)) {
                        LOGGER.Error(LocaleMessages.GetInstance().GetMessage(LocaleMessages.HEADER_BM_DISABLED), e);
                    }
                }
                l.AddRange(currentContentToParagraph);
            }
            return l;
        }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:37,代码来源:Header.cs

示例6: explodePdf

        /*
         * Explodes a pdf
         * */
        public static List<string> explodePdf(String inFile, String extractor, String repair)
        {

            FileInfo f = new FileInfo(inFile);
            inFile = f.FullName;
            List<string> theParts = new List<string>();

            try
            {
                CMDUtil cmd = new CMDUtil();
                UtilManager.repairPDF(inFile, repair);
                PdfReader reader = new PdfReader(inFile);
                int n = reader.NumberOfPages;
                String str;
                cmd.explode(inFile, extractor, "1-" + n);
                for (int i = 0; i < n; i++)
                {
                    str = f.FullName.Replace(".pdf", "-x" + (i + 1) + ".pdf");
                    UtilManager.repairPDF(str, repair);
                    theParts.Add(str);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);
            }
            System.Diagnostics.Debug.WriteLine("Exploded: " + theParts);
            return theParts;
        }
开发者ID:wtang2006,项目名称:SpiderWeb,代码行数:32,代码来源:UtilManager.cs

示例7: GetPatientInformation

        public void GetPatientInformation(string voterId)
        {
            List<Voter> voterList = new List<Voter>();
            using (var client = new WebClient())
            {
                var url = "http://nerdcastlebd.com/web_service/voterdb/index.php/voters/all/format/json";
                var jsonString = client.DownloadString(url);
                var json = new JavaScriptSerializer().Deserialize<dynamic>(jsonString);
                foreach (Dictionary<string, object> voter in json["voters"])
                {
                    Voter aVoter = new Voter();
                    aVoter.Id = voter["id"].ToString();
                    aVoter.Name = voter["name"].ToString();
                    aVoter.Address = voter["address"].ToString();
                    voterList.Add(aVoter);
                }
            }

            //string jsonStringCollection = "[{\"id\":\"5644309456813\",\"name\":\"Rimi Khanom\",\"address\":\"House no: 12. Road no: 14. Dhanmondi, Dhaka\",\"date_of_birth\":\"1979-01-15\"},{\"id\":\"9509623450915\",\"name\":\"Asif Latif\",\"address\":\"House no: 98. Road no: 14. Katalgonj, Chittagong\",\"date_of_birth\":\"1988-07-11\"},{\"id\":\"1098789543218\",\"name\":\"Rakib Hasan\",\"address\":\"Vill. Shantinagar. Thana: Katalgonj, Faridpur\",\"date_of_birth\":\"1982-04-12\"},{\"id\":\"7865409458659\",\"name\":\"Rumon Sarker\",\"address\":\"Kishorginj\",\"date_of_birth\":\"1970-12-02\"},{\"id\":\"8909854343334\",\"name\":\"Gaji Salah Uddin\",\"address\":\"Chittagong\",\"date_of_birth\":\"1965-06-16\"}]";
            //List<Voter> voterList = new JavaScriptSerializer().Deserialize<List<Voter>>(jsonStringCollection);
            foreach (var voter in voterList)
            {

                if (voter.Id.Equals(voterId))
                {
                    nameTextBox.Text = voter.Name;
                    addressTextBox.Text = voter.Address;

                }
            }
        }
开发者ID:nazruldiu,项目名称:CommunityMedicineAutomation,代码行数:31,代码来源:ShowAllHistoryUI.aspx.cs

示例8: Slice

        /// <summary>
        /// Slices the WMF image per pool.
        /// </summary>
        /// <returns>Returns an array of string with the path of sliced images.</returns>
        public string[] Slice()
        {
            if (string.IsNullOrEmpty(this.wmfPath))
            {
                throw new InvalidOperationException(GlobalStringResource.IMAGE_PATH_NOT_SUPPLIED);
            }

            List<int> whites = new List<int>();
            int x = 0;
            int width = 0;
            int height = 0;
            using (Bitmap baseImage = (Bitmap)Bitmap.FromFile(this.wmfPath))
            {
                height = baseImage.Height;
                width = baseImage.Width;
                for (int i = 0; i < baseImage.Height; i++)
                {
                    System.Drawing.Color c = baseImage.GetPixel(x, i);
                    if (c.A == 255 && c.B == 255 && c.R == 255 && c.G == 255)
                    {
                        if (i == 0) { continue; }
                        whites.Add(i);
                    }

                }
            }
            whites.Sort();
            List<System.Drawing.Rectangle> rectangles = CreateCoordinates(whites, width, height);
            return CropAndSave(rectangles);
        }
开发者ID:meanprogrammer,项目名称:sawebreports_migrated,代码行数:34,代码来源:SubProcessSlicer.cs

示例9: LastLogin

 public ActionResult LastLogin(int? page, string searchTerm = null)
 {
     int pageNumber = (page ?? 1);
     var auditorList = _context.Users.OrderByDescending(s => s.LastLogin).
         Where(p => searchTerm == null || p.UserName.StartsWith(searchTerm));
     var indexViewModel = new List<UserReportModel>();
     foreach (var n in auditorList)
     {
         var mygroup = _repository.Find<Group>(n.GroupId);
         //var days = n.LastLogin.Subtract(DateTime.Now).Days;
         var days = DateTime.Now.Subtract(n.LastLogin).Days;
         var model = new UserReportModel
         {
             Fullnames = n.FirstName +' '+ n.LastName,
             Username = n.UserName,
             Lastlogin = n.LastLogin,
             DaysLastLogin = days,
             Enabled = n.Enabled,
             StatusOptions = n.Status
         };
         indexViewModel.Add(model);
     }
     _getVals.LogAudit(User.Identity.GetUserName(), "Viewed", Request.UserHostName, "Viewed Last Login Report ",
         "ISA", "UserManagement");
     return View(indexViewModel.ToPagedList(pageNumber, pageSize));
 }
开发者ID:ongeri,项目名称:citieuc,代码行数:26,代码来源:AccountReportsController.cs

示例10: AutoResizeTableColumns

        /// <summary>
        /// Tries to auto resize the specified table columns.
        /// </summary>
        /// <param name="table">pdf table</param>
        public static void AutoResizeTableColumns(this PdfGrid table)
        {
            if (table == null) return;
            var currentRowWidthsList = new List<float>();
            var previousRowWidthsList = new List<float>();

            foreach (var row in table.Rows)
            {
                currentRowWidthsList.Clear();
                currentRowWidthsList.AddRange(row.GetCells().Select(cell => cell.GetCellWidth()));

                if (!previousRowWidthsList.Any())
                {
                    previousRowWidthsList = new List<float>(currentRowWidthsList);
                }
                else
                {
                    for (int i = 0; i < previousRowWidthsList.Count; i++)
                    {
                        if (previousRowWidthsList[i] < currentRowWidthsList[i])
                            previousRowWidthsList[i] = currentRowWidthsList[i];
                    }
                }
            }

            if (previousRowWidthsList.Any())
                table.SetTotalWidth(previousRowWidthsList.ToArray());
        }
开发者ID:VahidN,项目名称:PdfReport,代码行数:32,代码来源:ElementsWidth.cs

示例11: CheckRevocation

 public static int CheckRevocation(PdfPKCS7 pkcs7, X509Certificate signCert, X509Certificate issuerCert, DateTime date)
 {
     List<BasicOcspResp> ocsps = new List<BasicOcspResp>();
     if (pkcs7.Ocsp != null)
         ocsps.Add(pkcs7.Ocsp);
     OcspVerifier ocspVerifier = new OcspVerifier(null, ocsps);
     List<VerificationOK> verification =
         ocspVerifier.Verify(signCert, issuerCert, date);
     if (verification.Count == 0)
     {
         List<X509Crl> crls = new List<X509Crl>();
         if (pkcs7.CRLs != null)
             foreach (X509Crl crl in pkcs7.CRLs)
                 crls.Add(crl);
         CrlVerifier crlVerifier = new CrlVerifier(null, crls);
         verification.AddRange(crlVerifier.Verify(signCert, issuerCert, date));
     }
     if (verification.Count == 0)
     {
         Console.WriteLine("No se pudo verificar estado de revocación del certificado por CRL ni OCSP");
         return CER_STATUS_NOT_VERIFIED;
     }
     else
     {
         foreach (VerificationOK v in verification)
             Console.WriteLine(v);
         return 0;
     }
 }
开发者ID:bochi2511,项目名称:SignDoc,代码行数:29,代码来源:PdfSignature.cs

示例12: GetSortedImagesFromDirectory

 static List<string> GetSortedImagesFromDirectory(string directory)
 {
     string[] filenameArray = Directory.GetFiles(directory, "*.tif", SearchOption.TopDirectoryOnly);
     List<string> filenameList = new List<string>(filenameArray);
     filenameList.Sort(StringComparer.InvariantCultureIgnoreCase);
     return filenameList;
 }
开发者ID:aupasana,项目名称:dli-viewer,代码行数:7,代码来源:pdf.cs

示例13: CreatePDF

 /// <summary>
 /// 多图片生成PDF
 /// </summary>
 /// <param name="strImagePath">图片路径数据</param>
 /// <param name="FilePath">文件保存路径</param>
 /// <returns></returns>
 public static bool CreatePDF(List<string> strImagePath, string FilePath)
 {
     //创建Document对象,默认大小为A4
     Document pdfDocument = new Document();
     //打开并创建新的PDF文件
     PdfWriter.GetInstance(pdfDocument, new FileStream(FilePath, FileMode.Create));
     //打开上下文
     try
     {
         pdfDocument.Open();
         int iHeight = 460;//高度
         int iWidth = 480;//宽度
         foreach (string s in strImagePath)
         {
             // 获取image对象
             iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(new Uri(s));
             //设置图片对其方式
             img.Alignment = iTextSharp.text.Image.MIDDLE_ALIGN;
             //设置图片的相对大小,未超过指定高宽按原图尺寸
             if (img.ScaledHeight > iHeight && img.ScaledWidth > iWidth)
             {
                 img.ScaleAbsolute(iWidth, iHeight);
             }
             //添加新的文件
             pdfDocument.Add(img);
         }
         pdfDocument.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }
开发者ID:a526757124,项目名称:YCTYProject,代码行数:40,代码来源:CommonUpload.cs

示例14: BuildContent

 public override List<PdfContentParameter> BuildContent(EntityDTO dto)
 {
     dto.ExtractProperties();
     this.dto = dto;
     List<PdfContentParameter> contents = new List<PdfContentParameter>();
     contents.Add(base.CreateTitlePage(this.dto));
     contents.Add(base.CreateChangeHistory(this.dto));
     contents.Add(base.CreateReviewers(this.dto));
     contents.Add(base.CreateApprovers(this.dto));
     contents.Add(CreateTitle(GlobalStringResource.Report_Introduction));
     contents.Add(CreatePurpose());
     contents.Add(CreateProcessObjective());
     contents.Add(CreateStrategy());
     contents.Add(CreateStakeHolders());
     contents.Add(CreateProcessDescription());
     contents.Add(CreateProcessRelation());
     contents.Add(CreateSubProcessRelation());
     contents.Add(CreateTitle(GlobalStringResource.Report_References));
     contents.Add(CreateFrameworkReference());
     contents.Add(CreateInternalReference());
     contents.Add(CreateTitle(GlobalStringResource.Report_Appendices));
     contents.Add(CreateAcronyms());
     contents.Add(CreateDefintionOfTerms());
     contents.Add(CreateBookmarks());
     return contents;
 }
开发者ID:meanprogrammer,项目名称:sawebreports_migrated,代码行数:26,代码来源:ProcessReportStrategy.cs

示例15: ApiProviderViewPost

        public override ApiResponse ApiProviderViewPost(IRequest request)
        {
            var parentNodeId = new NodeIdentifier(
                   WebUtility.UrlDecode(request.PostArgs["parent_provider"]),
                   WebUtility.UrlDecode(request.PostArgs["parent_id"]));
            var parentNode = request.UnitOfWork.Nodes.FindById(parentNodeId);
            if (parentNode == null)
                return new BadRequestApiResponse();

            if (parentNode.User.Id != request.UserId)
                return new ForbiddenApiResponse();

            var results = new List<NodeWithRenderedLink>();
            if (string.IsNullOrEmpty(request.PostArgs["text"]))
                return new BadRequestApiResponse("Text is not specified");

            var newNode = new TextNode
            {
                DateAdded = DateTime.Now,
                Text = request.PostArgs["text"],
                User = request.User
            };

            request.UnitOfWork.Text.Save(newNode);
            results.Add(new NodeWithRenderedLink(newNode,
                Utilities.CreateLinkForNode(request, parentNode, newNode)));

            return new ApiResponse(results, 201, "Nodes added");
        }
开发者ID:bshishov,项目名称:Memorandum.Net,代码行数:29,代码来源:TextNodeProvider.cs


注:本文中的iTextSharp.text.List类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。