osmoz7 wrote: > I looked the examples in the tutorials and the book, but as I said, > I don't want to cut the PDF according to pages but according to offsets > and lengths.
Byte offsets and byte array lengths? Or Y coordinates on a page? Your code sample suggests the former, which is madness. If you want pieces of a page based on offset, you will have to import COMPLETE PAGES, because PDF is a PDL and therefore PAGE BASED. (PDL = Page Description Language.) If you have the offsets, you can clip the pages. How to do that? That's described in the book. > One thing I forgot to mention in my first message is that the PDF file that > I want to split is already a concatenation of several PDF files. So I just > want to get the pieces back. That's not a good idea. You should have kept the original pieces. Read the conclusion of section 3.2.1 on page 80: "creating PDF is a one-way process." > I don't think I need to know about table, resource dictionary, etc. to do > that. You need a sound knowledge about PDF if you want to manipulate a PDF file the way you did in your code sample. Chapter 18 of the book warns you: "A recurring remark about PdfWriter, PdfCopy, and PdfStamper, is that the API isn’t intuitive. Why can’t you just take reader objects, select pages, and then concatenate all of them using a writer? Or even better: Why can’t you take the content stream of a page, look up some words, and replace them or insert extra content at that specific position?" Ignoring the answer to these questions (offered in the book that you say you've looked at) is not very wise. > As I mentioned at the beginning, you don't answer my question. Some questions don't have an answer. See also: http://itext.ugent.be/library/question.php?id=42 > Hope someone else could help me. I don't think that will happen. Your current question is unanswerable. It makes me think of the Fredric Brown story "The Weapon": you don't give a real gun to a child as a play toy. Similarly you don't give people who refuse to learn (saying "I don't think I need to know about table, resource dictionary, etc.") an assignment like this one. By the way: I didn't talk about "a table", I was talking about "the Cross-Reference table". There's a huge difference. Bottom line: you won't understand any answer if you're not willing to learn. If you want to cut pieces of pages for reuse, you have all the answers in the book. -- This answer is provided by 1T3XT BVBA ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
