/**
  * Processes a properly tagged PDF form.
  * @param reader the PdfReader instance holding the PDF
  * @throws IOException
  * @throws DocumentException 
  */
 virtual public void Process(PdfReader reader, Stream os) {
     int n = reader.NumberOfPages;
     // getting the root dictionary
     PdfDictionary catalog = reader.Catalog;
     // flattening means: remove AcroForm
     catalog.Remove(PdfName.ACROFORM);
     // read the structure and create a parser
     StructureItems items = new StructureItems(reader);
     MCParser parser = new MCParser(items);
     // loop over all pages
     for(int i = 1; i <= n; i++) {
         // make one stream of a content stream array
         reader.SetPageContent(i, reader.GetPageContent(i));
         // parse page
         parser.Parse(reader.GetPageN(i), reader.GetPageOrigRef(i));
     }
     reader.RemoveUnusedObjects();
     // create flattened file
     PdfStamper stamper = new PdfStamper(reader, os);
     items.WriteParentTree(stamper.Writer);
     stamper.Close();
 }
Exemple #2
0
 /**
  * @see com.itextpdf.text.pdf.mc.MCParser.PdfOperator#process(com.itextpdf.text.pdf.mc.MCParser, com.itextpdf.text.pdf.PdfLiteral, java.util.List)
  */
 virtual public void Process(MCParser parser, PdfLiteral opr, IList<PdfObject> operands) {
     parser.PrintTextOperator(opr, operands);
 }
Exemple #3
0
 /**
  * @see com.itextpdf.text.pdf.mc.MCParser.PdfOperator#process(com.itextpdf.text.pdf.mc.MCParser, com.itextpdf.text.pdf.PdfLiteral, java.util.List)
  */
 virtual public void Process(MCParser parser, PdfLiteral opr, IList<PdfObject> operands) {
     IList<PdfObject> list = new List<PdfObject>();
     list.Add(TSTAR);
     parser.PrintTextOperator(MCParser.TSTAR, list);
 }
Exemple #4
0
 /**
  * @see com.itextpdf.text.pdf.mc.MCParser.PdfOperator#process(com.itextpdf.text.pdf.mc.MCParser, com.itextpdf.text.pdf.PdfLiteral, java.util.List)
  */
 virtual public void Process(MCParser parser, PdfLiteral opr, IList<PdfObject> operands) {
     LOGGER.Debug("BT: begin text on hold");
     parser.SetInText(true);
 }
Exemple #5
0
 /**
  * @see com.itextpdf.text.pdf.mc.MCParser.PdfOperator#process(com.itextpdf.text.pdf.mc.MCParser, com.itextpdf.text.pdf.PdfLiteral, java.util.List)
  */
 virtual public void Process(MCParser parser, PdfLiteral opr, IList<PdfObject> operands) {
     LOGGER.Debug("ET: end text block");
     parser.SetInText(false);
     parser.PrintOperator(opr, operands);
 }
Exemple #6
0
		    /**
		     * @see com.itextpdf.text.pdf.mc.MCParser.PdfOperator#process(com.itextpdf.text.pdf.mc.MCParser, com.itextpdf.text.pdf.PdfLiteral, java.util.List)
		     */
		    virtual public void Process(MCParser parser, PdfLiteral operatora, IList<PdfObject> operands) {
			    if (operands[0].IsName())
				    parser.DealWithXObj((PdfName)operands[0]);
			    parser.PrintOperator(operatora, operands);
		    }
Exemple #7
0
 /**
  * @see com.itextpdf.text.pdf.mc.MCParser.PdfOperator#process(com.itextpdf.text.pdf.ocg.OCGParser, com.itextpdf.text.pdf.PdfLiteral, java.util.List)
  */
 virtual public void Process(MCParser parser, PdfLiteral opr, IList<PdfObject> operands) {
     if(operands[1].IsDictionary()) {
         PdfDictionary dict = (PdfDictionary)operands[1];
         parser.DealWithMcid(dict.GetAsNumber(PdfName.MCID));
     }
     parser.PrintOperator(opr, operands);
 }
Exemple #8
0
 /**
  * @see com.itextpdf.text.pdf.mc.MCParser.PdfOperator#process(com.itextpdf.text.pdf.mc.MCParser, com.itextpdf.text.pdf.PdfLiteral, java.util.List)
  */
 virtual public void Process(MCParser parser, PdfLiteral opr, IList <PdfObject> operands)
 {
     parser.PrintTextOperator(opr, operands);
 }
Exemple #9
0
 /**
  * @see com.itextpdf.text.pdf.mc.MCParser.PdfOperator#process(com.itextpdf.text.pdf.mc.MCParser, com.itextpdf.text.pdf.PdfLiteral, java.util.List)
  */
 virtual public void Process(MCParser parser, PdfLiteral opr, IList <PdfObject> operands)
 {
     LOGGER.Debug("ET: end text block");
     parser.SetInText(false);
     parser.PrintOperator(opr, operands);
 }
Exemple #10
0
 /**
  * @see com.itextpdf.text.pdf.mc.MCParser.PdfOperator#process(com.itextpdf.text.pdf.mc.MCParser, com.itextpdf.text.pdf.PdfLiteral, java.util.List)
  */
 virtual public void Process(MCParser parser, PdfLiteral opr, IList <PdfObject> operands)
 {
     LOGGER.Debug("BT: begin text on hold");
     parser.SetInText(true);
 }