Here's some code to add an hanging stream:

import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;

public class oce_block {
    public static void main(String args[]) {
        try {
            PdfReader originalPDF = new PdfReader( "c:\\file.pdf" );
            FileOutputStream os = new FileOutputStream( "c:\\oce_block.pdf"
);
            PdfStamper stamper = new PdfStamper(originalPDF, os);
            PdfWriter writer = stamper.getWriter();
            byte b[] = "Something to put inside the stream.".getBytes();
            PdfStream stream = new PdfStream(b);
            stream.put(new PdfName("INFOBLOCK"), new PdfName("INTERN"));
            stream.flateCompress();
            writer.addToBody(stream);
            stamper.close();
        }
        catch ( Exception e ) {
            e.printStackTrace();
        }
    }
}

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Carsten Hammer [SMTP:[EMAIL PROTECTED]
> Sent: Sunday, September 21, 2003 16:47
> To:   [EMAIL PROTECTED]
> Subject:      [iText-questions] Re: appending a pdf document update block
> 
> Hi Paulo,
> 
> Paulo Soares schrieb:
> > iText can't make incremental changes but nothing prevents you from
> adding a
> > custom tag to the catalog and output it with PdfStamper. You can also
> add an
> 
> how?
> Could you give me a short explanation what sourcefiles and methods are 
> relevant?
> 
> > object hanged on nowhere if you don't need it to survive further
> processing.
> > 
> 
> That is more or less what I need. Oc� printers allow to print pdf files 
> directly. To be able to adjust processing instructions 
> (simplex,duplex,paper tray,etc.) they allow to insert these processing 
> instructions within the pdf files inside such a document update block.
> 
> If I understand it right I could use itext to produce a pdf document in 
> memory and pdfstamper to produce a document update block for this 
> in-memory pdf document. Of course all this has nothing to do with the 
> PDF standard written by Adobe even if these files should still be 
> conforming...
> 
> Thanks in advance,
> Carsten
> 
> 
> > Best Regards,
> > Paulo Soares
> > 
> > ----- Original Message -----
> > From: "Carsten Hammer" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, September 19, 2003 10:12
> > Subject: [iText-questions] appending a pdf document update block
> > 
> > 
> > 
> >>Hi,
> >>is it possible to use itext to generate a pdf document + pdf document
> >>update block like this:
> >>
> >>[beginning of the pdf document deleted]
> >>...
> >>trailer
> >><<
> >>/Size 9
> >>/Root 1 0 R
> >>/Info 8 0 R
> >> >>
> >>startxref
> >>64692
> >>%%EOF                 <--- here is the end of the generated pdf document
> >>9 0 obj
> >><<
> >>/INFOBLOCK INTERN
> >>/Length 490
> >> >>
> >>stream
> >><some text information>
> >><more text information>
> >>endstream
> >>endobj
> >>xref
> >>0 1
> >>0000000000 65535 f
> >>9 1
> >>0000064949 00000 f
> >>trailer
> >><<
> >>/Size 10
> >>/Root 1 0 R
> >>/Info 8 0 R
> >>/Prev 64692
> >> >>
> >>startxref
> >>0000065505
> >>%%EOF  <--- here is the end of the generated pdf document update block
> >>
> >>How can I do this? Can itext help me doing this? I need the update block
> >>because I want to transport some additional information inside of the
> >>pdf. That this pdf file structure does not survive further manipulations
> >>
> >>does not matter.
> >>
> >>Best regards,
> >>Carsten Hammer
> >>
> >>PS: it is important to get exactly this pdf structure.
> >>
> >>
> >>
> >>
> >>-------------------------------------------------------
> >>This sf.net email is sponsored by:ThinkGeek
> >>Welcome to geek heaven.
> >>http://thinkgeek.com/sf
> >>_______________________________________________
> >>iText-questions mailing list
> >>[EMAIL PROTECTED]
> >>https://lists.sourceforge.net/lists/listinfo/itext-questions
> >>
> > 
> > 
> > 
> > 
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to