本文整理汇总了C#中iTextSharp.text.pdf.parser.PdfContentStreamProcessor类的典型用法代码示例。如果您正苦于以下问题:C# PdfContentStreamProcessor类的具体用法?C# PdfContentStreamProcessor怎么用?C# PdfContentStreamProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PdfContentStreamProcessor类属于iTextSharp.text.pdf.parser命名空间,在下文中一共展示了PdfContentStreamProcessor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PopulateOperators
public static void PopulateOperators(PdfContentStreamProcessor contentProcessor,
PdfCleanUpRenderListener pdfCleanUpRenderListener) {
foreach (String oper in contentProcessor.RegisteredOperatorStrings) {
PdfCleanUpContentOperator contentOperator = new PdfCleanUpContentOperator(pdfCleanUpRenderListener);
contentOperator.originalContentOperator = contentProcessor.RegisterContentOperator(oper, contentOperator);
}
}
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:7,代码来源:PdfCleanUpContentOperator.cs
示例2: extractSnippets
public void extractSnippets(String src, String dest)
{
TextWriter output = new StreamWriter(new FileStream(dest, FileMode.Create));
PdfReader reader = new PdfReader(src);
IRenderListener listener = new MyTextRenderListener(output);
PdfContentStreamProcessor processor =
new PdfContentStreamProcessor(listener);
PdfDictionary pageDic = reader.GetPageN(1);
PdfDictionary resourcesDic = pageDic.GetAsDict(PdfName.RESOURCES);
processor.ProcessContent(ContentByteUtils.GetContentBytesForPage(reader, 1), resourcesDic);
output.Flush();
output.Close();
reader.Close();
}
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:14,代码来源:S05_ExtractSnippets.cs
示例3: WeirdHyphensTest
virtual public void WeirdHyphensTest() {
PdfReader reader = TestResourceUtils.GetResourceAsPdfReader(TEST_RESOURCES_PATH, "WeirdHyphens.pdf");
List<String> textChunks = new List<String>();
IRenderListener listener = new MyTextRenderListener(textChunks);
PdfContentStreamProcessor processor = new PdfContentStreamProcessor(listener);
PdfDictionary pageDic = reader.GetPageN(1);
PdfDictionary resourcesDic = pageDic.GetAsDict(PdfName.RESOURCES);
processor.ProcessContent(ContentByteUtils.GetContentBytesForPage(reader, 1), resourcesDic);
/**
* This assertion makes sure that encoding has been read properly from FontDescriptor.
* If not the vallue will be "\u0000 14".
*/
Assert.AreEqual("\u0096 14", textChunks[18]);
reader.Close();
}
开发者ID:jagruti23,项目名称:itextsharp,代码行数:15,代码来源:CMapAwareDocumentFontTest.cs
示例4: collectDataforDay
/**
* Put all data from given day into given table
*/
public static void collectDataforDay(DateTime dateTime, SQLiteConnection m_dbConnection)
{
string zeroMonth = dateTime.Month < 10 ? "0" : "";
string zeroDay = dateTime.Day < 10 ? "0" : "";
string date = zeroMonth + dateTime.Month + "/" + zeroDay + dateTime.Day + "/" + dateTime.Year;
PdfReader reader;
try
{
reader = new PdfReader("http://www.equibase.com/premium/eqbPDFChartPlus.cfm?RACE=A&BorP=P&TID=SAR&CTRY=USA&DT=" + date + "&DAY=D&STYLE=EQB");
}
catch (Exception e)
{
Console.WriteLine("CAPTCHA TIME");
Console.ReadKey();
Console.ReadKey();
reader = new PdfReader("http://www.equibase.com/premium/eqbPDFChartPlus.cfm?RACE=A&BorP=P&TID=SAR&CTRY=USA&DT=" + date + "&DAY=D&STYLE=EQB");
}
StringBuilder builder = new StringBuilder();
for (int x = 1; x <= reader.NumberOfPages; x++)
{
PdfDictionary page = reader.GetPageN(x);
IRenderListener listener = new SBTextRenderer(builder);
PdfContentStreamProcessor processor = new PdfContentStreamProcessor(listener);
PdfDictionary pageDic = reader.GetPageN(x);
PdfDictionary resourcesDic = pageDic.GetAsDict(PdfName.RESOURCES);
processor.ProcessContent(ContentByteUtils.GetContentBytesForPage(reader, x), resourcesDic);
}
if (pages.Count != 0)
{
DataHandler handler = new DataHandler(dateTime, pages, m_dbConnection);
Thread thread = new Thread(new ThreadStart(handler.extractPdfData));
thread.Start();
thread.Join();
reader.Dispose();
pages.Clear();
}
else
{
// If there were no races on this particular day, simply skip it! :D
Console.WriteLine("Invalid Date: " + date);
}
}
开发者ID:ryanlough,项目名称:Horse-Racing-Analytic-Betting,代码行数:51,代码来源:Program.cs
示例5: ProcessBytes
private void ProcessBytes(
string resourceName,
int pageNumber)
{
PdfReader pdfReader = TestResourceUtils.GetResourceAsPdfReader(TEST_RESOURCES_PATH, resourceName);
PdfDictionary pageDictionary = pdfReader.GetPageN(pageNumber);
PdfDictionary resourceDictionary = pageDictionary.GetAsDict(PdfName.RESOURCES);
PdfObject contentObject = pageDictionary.Get(PdfName.CONTENTS);
byte[] contentBytes = ReadContentBytes(contentObject);
PdfContentStreamProcessor processor = new PdfContentStreamProcessor(_renderListener);
processor.ProcessContent(contentBytes, resourceDictionary);
}
开发者ID:jagruti23,项目名称:itextsharp,代码行数:16,代码来源:PdfContentStreamProcessorTest.cs
示例6: TestType3FontWidth
public void TestType3FontWidth() {
String inFile = "type3font_text.pdf";
LineSegment origLineSegment = new LineSegment(new Vector(20.3246f, 769.4974f, 1.0f), new Vector(151.22923f, 769.4974f, 1.0f));
PdfReader reader = TestResourceUtils.GetResourceAsPdfReader(TEST_RESOURCES_PATH, inFile);
TextPositionRenderListener renderListener = new TextPositionRenderListener();
PdfContentStreamProcessor processor = new PdfContentStreamProcessor(renderListener);
PdfDictionary pageDic = reader.GetPageN(FIRST_PAGE);
PdfDictionary resourcesDic = pageDic.GetAsDict(PdfName.RESOURCES);
processor.ProcessContent(ContentByteUtils.GetContentBytesForPage(reader, FIRST_PAGE), resourcesDic);
Assert.AreEqual(renderListener.LineSegments[FIRST_ELEMENT_INDEX].GetStartPoint()[FIRST_ELEMENT_INDEX],
origLineSegment.GetStartPoint()[FIRST_ELEMENT_INDEX], 1/2f);
Assert.AreEqual(renderListener.LineSegments[FIRST_ELEMENT_INDEX].GetEndPoint()[FIRST_ELEMENT_INDEX],
origLineSegment.GetEndPoint()[FIRST_ELEMENT_INDEX], 1/2f);
}
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:20,代码来源:TextRenderInfoTest.cs
示例7: Invoke
public void Invoke(PdfContentStreamProcessor processor,
PdfLiteral oper, List<PdfObject> operands)
{
processor.EndMarkedContent();
}
开发者ID:Gianluigi,项目名称:dssnet,代码行数:5,代码来源:PdfContentStreamProcessor.cs
示例8: HandleXObject
public void HandleXObject(PdfContentStreamProcessor processor, PdfStream xobjectStream, PdfIndirectReference refi) {
PdfDictionary colorSpaceDic = processor.resources.GetAsDict(PdfName.COLORSPACE);
ImageRenderInfo renderInfo = ImageRenderInfo.CreateForXObject(processor.Gs().ctm, refi, colorSpaceDic);
processor.renderListener.RenderImage(renderInfo);
}
开发者ID:Gianluigi,项目名称:dssnet,代码行数:5,代码来源:PdfContentStreamProcessor.cs
示例9: SpaceTrimColumnTextTest
public virtual void SpaceTrimColumnTextTest() {
Document doc = new Document(PageSize.A4, 50, 30, 50, 30);
PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(OUTSPTRIMCT, FileMode.Create));
doc.Open();
Phrase under = new Phrase();
under.Font = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.UNDERLINE);
under.Add(new Chunk(" 1 1 9 "));
Paragraph underlineTest = new Paragraph(under);
underlineTest.KeepTogether = true;
doc.Add(underlineTest);
doc.Close();
writer.Close();
PdfReader reader = new PdfReader(OUTSPTRIMCT);
MyTextRenderListener listener = new MyTextRenderListener();
PdfContentStreamProcessor processor = new PdfContentStreamProcessor(listener);
PdfDictionary pageDic = reader.GetPageN(1);
PdfDictionary resourcesDic = pageDic.GetAsDict(PdfName.RESOURCES);
processor.ProcessContent(ContentByteUtils.GetContentBytesForPage(reader, 1), resourcesDic);
Assert.IsTrue(listener.GetText().Length == 60, "Unexpected text length");
}
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:24,代码来源:ChunkTest.cs
注:本文中的iTextSharp.text.pdf.parser.PdfContentStreamProcessor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论