Beispiel #1
0
        public virtual void FileSpecCheckTest03()
        {
            PdfWriter       writer       = new PdfWriter(new MemoryStream());
            Stream          @is          = new FileStream(sourceFolder + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read);
            PdfOutputIntent outputIntent = new PdfOutputIntent("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1"
                                                               , @is);
            PdfADocument pdfDocument = new PdfADocument(writer, PdfAConformanceLevel.PDF_A_2B, outputIntent);
            PdfPage      page        = pdfDocument.AddNewPage();
            PdfFont      font        = PdfFontFactory.CreateFont(sourceFolder + "FreeSans.ttf", "WinAnsi", true);
            PdfCanvas    canvas      = new PdfCanvas(page);

            canvas.SaveState().BeginText().MoveText(36, 700).SetFontAndSize(font, 36).ShowText("Hello World!").EndText
                ().RestoreState();
            MemoryStream           txt  = new MemoryStream();
            FormattingStreamWriter @out = new FormattingStreamWriter(txt);

            @out.Write("<foo><foo2>Hello world</foo2></foo>");
            @out.Dispose();
            pdfDocument.AddFileAttachment("foo file", PdfFileSpec.CreateEmbeddedFileSpec(pdfDocument, txt.ToArray(), "foo file"
                                                                                         , "foo.xml", PdfName.ApplicationXml, null, PdfName.Source));
            pdfDocument.Close();
        }
Beispiel #2
0
 private void Outval(int n)
 {
     output.Write(' ');
     output.Write(n);
 }