ToPdf() public method

public ToPdf ( PdfWriter writer, Stream os ) : void
writer PdfWriter
os Stream
return void
            internal void WriteTo()
            {
                var dic = new PdfDictionary();

                dic.Put(PdfName.Fields, Calculate(_fdf._fields));
                if (_fdf.File != null)
                {
                    dic.Put(PdfName.F, new PdfString(_fdf.File, PdfObject.TEXT_UNICODE));
                }

                var fd = new PdfDictionary();

                fd.Put(PdfName.Fdf, dic);
                var refi = AddToBody(fd).IndirectReference;
                var b    = GetIsoBytes("trailer\n");

                ((DocWriter)this).Os.Write(b, 0, b.Length);
                var trailer = new PdfDictionary();

                trailer.Put(PdfName.Root, refi);
                trailer.ToPdf(null, ((DocWriter)this).Os);
                b = GetIsoBytes("\n%%EOF\n");
                ((DocWriter)this).Os.Write(b, 0, b.Length);
                ((DocWriter)this).Os.Dispose();
            }
Exemplo n.º 2
0
            internal void Write()
            {
                foreach (PdfReaderInstance element in readerInstances.Values)
                {
                    currentPdfReaderInstance = element;
                    currentPdfReaderInstance.WriteAllPages();
                }

                PdfDictionary dic = new PdfDictionary();

                dic.Put(PdfName.FIELDS, Calculate(fdf.fields));
                if (fdf.file != null)
                {
                    dic.Put(PdfName.F, new PdfString(fdf.file, PdfObject.TEXT_UNICODE));
                }
                if (!string.IsNullOrEmpty(fdf.statusMessage))
                {
                    dic.Put(PdfName.STATUS, new PdfString(fdf.statusMessage));
                }
                PdfDictionary fd = new PdfDictionary();

                fd.Put(PdfName.FDF, dic);
                PdfIndirectReference refi = AddToBody(fd).IndirectReference;

                byte[] b = GetISOBytes("trailer\n");
                os.Write(b, 0, b.Length);
                PdfDictionary trailer = new PdfDictionary();

                trailer.Put(PdfName.ROOT, refi);
                trailer.ToPdf(null, os);
                b = GetISOBytes("\n%%EOF\n");
                os.Write(b, 0, b.Length);
                os.Close();
            }
Exemplo n.º 3
0
            internal void WriteTo()
            {
                PdfDictionary dic = new PdfDictionary();

                dic.Put(PdfName.FIELDS, Calculate(fdf.fields));
                if (fdf.file != null)
                {
                    dic.Put(PdfName.F, new PdfString(fdf.file, PdfObject.TEXT_UNICODE));
                }
                PdfDictionary fd = new PdfDictionary();

                fd.Put(PdfName.FDF, dic);
                PdfIndirectReference refi = AddToBody(fd).IndirectReference;

                byte[] b = GetISOBytes("trailer\n");
                os.Write(b, 0, b.Length);
                PdfDictionary trailer = new PdfDictionary();

                trailer.Put(PdfName.ROOT, refi);
                trailer.ToPdf(null, os);
                b = GetISOBytes("\n%%EOF\n");
                os.Write(b, 0, b.Length);
                os.Close();
            }
Exemplo n.º 4
0
 /**
 * Begins a marked content sequence. If property is <CODE>null</CODE> the mark will be of the type
 * <CODE>BMC</CODE> otherwise it will be <CODE>BDC</CODE>.
 * @param tag the tag
 * @param property the property
 * @param inline <CODE>true</CODE> to include the property in the content or <CODE>false</CODE>
 * to include the property in the resource dictionary with the possibility of reusing
 */
 public void BeginMarkedContentSequence(PdfName tag, PdfDictionary property, bool inline)
 {
     if (property == null) {
         content.Append(tag.GetBytes()).Append(" BMC").Append_i(separator);
         SetMcDepth(GetMcDepth() + 1);
         return;
     }
     content.Append(tag.GetBytes()).Append(' ');
     if (inline)
         property.ToPdf(writer, content);
     else {
         PdfObject[] objs;
         if (writer.PropertyExists(property))
             objs = writer.AddSimpleProperty(property, null);
         else
             objs = writer.AddSimpleProperty(property, writer.PdfIndirectReference);
         PdfName name = (PdfName)objs[0];
         PageResources prs = PageResources;
         name = prs.AddProperty(name, (PdfIndirectReference)objs[1]);
         content.Append(name.GetBytes());
     }
     content.Append(" BDC").Append_i(separator);
     SetMcDepth(GetMcDepth() + 1);
 }
Exemplo n.º 5
0
 internal void WriteTo() {
     PdfDictionary dic = new PdfDictionary();
     dic.Put(PdfName.FIELDS, Calculate(fdf.fields));
     if (fdf.file != null)
         dic.Put(PdfName.F, new PdfString(fdf.file, PdfObject.TEXT_UNICODE));
     PdfDictionary fd = new PdfDictionary();
     fd.Put(PdfName.FDF, dic);
     PdfIndirectReference refi = AddToBody(fd).IndirectReference;
     byte[] b = GetISOBytes("trailer\n");
     os.Write(b, 0, b.Length);
     PdfDictionary trailer = new PdfDictionary();
     trailer.Put(PdfName.ROOT, refi);
     trailer.ToPdf(null, os);
     b = GetISOBytes("\n%%EOF\n");
     os.Write(b, 0, b.Length);
     os.Close();
 }
Exemplo n.º 6
0
            internal void Write() {
                foreach (PdfReaderInstance element in readerInstances.Values) {
                    currentPdfReaderInstance = element;
                    currentPdfReaderInstance.WriteAllPages();
                }

                PdfDictionary dic = new PdfDictionary();
                dic.Put(PdfName.FIELDS, Calculate(fdf.fields));
                if (fdf.file != null)
                    dic.Put(PdfName.F, new PdfString(fdf.file, PdfObject.TEXT_UNICODE));
                if (!string.IsNullOrEmpty(fdf.statusMessage))
                    dic.Put(PdfName.STATUS, new PdfString(fdf.statusMessage));
                PdfDictionary fd = new PdfDictionary();
                fd.Put(PdfName.FDF, dic);
                PdfIndirectReference refi = AddToBody(fd).IndirectReference;
                byte[] b = GetISOBytes("trailer\n");
                os.Write(b, 0, b.Length);
                PdfDictionary trailer = new PdfDictionary();
                trailer.Put(PdfName.ROOT, refi);
                trailer.ToPdf(null, os);
                b = GetISOBytes("\n%%EOF\n");
                os.Write(b, 0, b.Length);
                os.Close();
            }