You can't use Document.add(). This is only a problem with Graphic but in any case you have the same in PdfContentByte. Add the images with PdfContentByte.addImage().
To set a clipping area:
PdfContentByte cb = writer.getDirectContent();
cb.saveState();
cb.rectangle(100, 100, 100, 100); //the clipping area
cb.clip();
cb.newPath();
// do your drawing here
cb.restoreState();
// do the same for other areas
Best Regards,
Paulo Soares
-----Original Message-----
From: Neil Taylor [SMTP:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 13:08
To: Paulo Soares
Cc: [EMAIL PROTECTED]
Subject: Re: [iText-questions] multipage display on one page of PDF document
I currently create a new Document and get the Writer.
Each mini-page can contain Graphic items (lines, ellipses and rectangles), Image items and text. Graphic and Image items are added using the document.add() method. The fonts are written by calling writer.getDirectContent() and then writing to the PdfContentByte object using beginText(), setFontAndSize(), setColorFill(), setTextMatrix(), showText() and endText(). Each of the items in each mini-page is to be positioned at a specific x,y coordinate.
If I want to put four pages onto one page, the idea is that the overall size of each mini-page will be set to a required reduced area - therefore I don't need any scaling for this application. I would just like the ability that when I draw a mini-page, e.g. top left, anything outside of the bounds of the top-left corner is clipped and therefore doesn't risk bleeding into another area.
Best Regards,
Neil
On Monday, January 12, 2004, at 12:05 pm, Paulo Soares wrote:
This is a totally different case. It all depends on what classes you use to do it, the kind of data, etc.
More detail is needed. You probably won't need templates and do all the work with ColumnText and PdfPTable.
(It's better to stay on the mailing list)
Best Regards.
Paulo Soares
-----Original Message-----
From:�� Neil Taylor [SMTP:[EMAIL PROTECTED]
Sent:�� Monday, January 12, 2004 11:45
To:���� Paulo Soares
Subject:������� Re: [iText-questions] multipage display on one page of PDF document
Dear Paulo,�
thanks for your quick response.�
The four pages will actually be generated from within my application, rather than come from another PDF file.� I would like to draw the first page into the top left, the second page into the top right, the third page into the bottom left and the fourth page into the bottom right.�
Each section will contain some slightly different information (an address).�
Does this mean that I would create the PDFWriter, call getDirectContent() and then create a template for the 1/4 of the page I am interested in?� So, would I require 4 templates if I wanted 4 pages printed on one page? How do PdfContentByte.clip() and PdfContentByte.newPath() relate to this? I don't understand from the Javadoc what they are actually operating on/doing.���
Best Regards,�
Neil�
On Monday, January 12, 2004, at 11:17� am, Paulo Soares wrote:
You have a bit of work ahead, not with the clipping and rotating the pages, but with the layout if the pages have different sizes. The methods you'll need are:
PdfWriter.getImportedPage() - to get the page from other pdf
PdfContentByte.addTemplate() - to place the page
PdfReader.getPagesize() and PdfReader.getCropBox() - to know the page dimensions
PdfContentByte.clip() and PdfContentByte.newPath() - for clipping
Best Regards,
Paulo Soares
-----Original Message-----
From:�� [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED] On Behalf Of Neil Taylor
Sent:�� Monday, January 12, 2004 0:23
To:���� [EMAIL PROTECTED]
Subject:������� [iText-questions] multipage display on one page of PDF document
Hi,
I am writing an application where there is a feature to print multiple
pages onto each sheet in the PDF. Therefore if I had a document with 6
pages, and chose to print 4 pages per sheet, then I would end up with a
2 page PDF with four 'pages' arranged on the first sheet and two
'pages' arranged on the second sheet.
My current approach within the application is to determine how many
'pages' will be printed on each PDF page. Then size the various pages
and output them to the PDF page and move onto the next page.
There is the possibility that an item on any of the reduced sized pages
may overrun its set area, and thus print into other areas of the final
PDF page. Is there a way to clip each area. I have seen references to a
clip() method in PDFContentByte, but it isn't clear to me how this can
be used. What defines a clip area?
Is it possible to set a clip area for each 1/4 of the page, write some
elements to the relevant 1/4 of a page and anything that is outside the
clip area is not drawn in the document?
Is there a better approach to doing this with iText?
Thanks for any assistance,
Neil
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions
