thank you for the fast reply!
I unfortunately dont have had a time to dive into the book prior to use a
library, however I consider buying it if iText gets me to the goal :-)
Ok, I see that you've described that in the book, but why did you not secure
appropriate methods? Ideally, the API would not allow to do anything what
does not makes sense, but I dont gonna talk about software design here ;)
Why I have to rotate and rescale is, because some pages of a source document
have to be converted from A4 to A5 and put in one page (2in1), while others
shall remain untouched. Maybe there is already a helper which does this task
but I've overseen it.
I've claimed that I couldn't copy a page AS-IS, because I did not located
API for it, like provided by PdfCopy, so the following works fine for me:
PdfImportedPage page = writer.getImportedPage(reader, i);
cb.getPdfDocument().setPageSize(page.getBoundingBox());
cb.getPdfDocument().newPage();
cb.addTemplate(page, 0, 0);
fortunately I dont going to have any annotations in the source document so
it is fine to ignore them in my case.
I believe there is a better way to perform this task, maybe you'd tell me
the way you'd go for it? Should I rather use PdfStamper for it?
And finally, if I got right its impossible to work on all levels of the
document at same time, since all the PdfWriter, PdfCopy, PdfStamper etc.
operate at outputstream level and you cannot mix them on an open stream, can
you?
tx
2010/5/27 Bruno Lowagie (iText) [via iText - General]
ml-node+2233101-1020509557-270...@n4.nabble.comml-node%2b2233101-1020509557-270...@n4.nabble.com
E Plischke wrote:
Hi, following instruction has no effect:
[CODE]
pdfCopy.getDirectContent().addTemplate(
pdfCopy.getImportedPage(pdfReader, 1), tagetAffineTransform
);
[/CODE]
is this a bug or do I miss something?
That's not a bug. As documented in chapter 6 of the book: you can't
manipulate the content of the pages if you choose PdfCopy. Unless you
use the methods described in section 6.4.1 of the Second Edition of
iText in Action.
i want to merge some pages from source PDF into a new Document, while
some of them is a simple 1:1 copy (which are handled by
PdfCopy.addPage(..) method and some of them are going to be weaved
rotated and scaled, so I use the PdfContentByte.addTemplate() to achieve
it (like in code above).
If you only need to rotate the page, then you should try the RotatePages
example from section 13.3.2. It's an example with PdfStamper, but it
should also work for PdfCopy.
If you really need to scale the page, reconsider: why do you want to
scale it? PDF is a digital format, the viewer can scale it for you.
The issue is that with PdfWriter (instead of PdfCopy) the addTemplate()
works fine, but not when applied on PdfCopy object, and while working
with PdfWriter I cannot simply copy a page as-is from source PDF,
With PdfWriter you can copy the CONTENT of the page AS-IS from the
source PDF, WITHOUT the annotations, because annotations are not part of
the page content. Is that why you claim that you can't copy a page AS-IS
with PdfWriter?
therefore I wanted to handle both cases with PdfCopy instance.
Yes, but if you use addTemplate(), you only copy the page content, not
the annotations. And if that's your problem with PdfWriter, your (wrong)
approach wouldn't solve anything, would it?
I'd use the RotatePages approach and NOT scale the pages, only rotate
them (if necessary).
Note that I have no idea what you mean by weaved. Are you talking
about superimposing pages? In that case, you need the Adding content
with PdfCopy example from section 6.4.1.
--
___
iText-questions mailing list
[hidden email] http://user/SendEmail.jtp?type=nodenode=2233101i=0
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list:
http://1t3xt.info/tutorials/keywords/
--
View message @
http://itext-general.2136553.n4.nabble.com/PdfCopy-ignores-manipulations-on-directContent-tp2233087p2233101.html
To start a new topic under iText - General, email
ml-node+2136553-676953162-270...@n4.nabble.comml-node%2b2136553-676953162-270...@n4.nabble.com
To unsubscribe from iText - General, click
herehttp://itext-general.2136553.n4.nabble.com/subscriptions/Unsubscribe.jtp?code=ZXBsaXNjaGtlQGdvb2dsZW1haWwuY29tfDIxMzY1NTN8MjEyNjk0NjI3MQ==.
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/PdfCopy-ignores-manipulations-on-directContent-tp2233087p2233148.html
Sent from the iText - General mailing list archive at Nabble.com.