I believe the intial suggestion is to make the original pages smaller.
8.5x5.5 rather than 8.5x11 or some such.  Then you don't need to worry
about clipping via any method:

PdfImportedPage inherits from PdfTemplate, so drawing multiple pages on
a single page isn't particularly hard, it's just a matter of getting
them to fit, THUSLY:

PdfTemplate topOfPage = writer.getImportedPage( reader, 1 );
PdfTemplate bottomOfPage = writer.getImportedPage( reader, 2 );

PdfContentByte content = writer.getDirectContent();

// in PDF, "0, 0" is the lower left corner.
content.addTemplate( bottomOfPage );
content.addTemplate( topOfPage, 0, bottomOfPage.getHeight() );
// stupid case correcting email client... Grumble grumble.  SEE!?


All this is assuming that "reader" page 1 and page 2 add up to the same
height as the page you're currently building in "writer".  Well... it'll
execute regardless, but what's visible will fall well into "YMMV-ville"
depending on page widths and heights.

BTW: The technical term for putting multiple pages on a single sheet of
paper is "imposition".  It's used in the printing industry quite a bit,
often when they plan to fold the paper to get a final product (cereal
boxes perhaps).


--Mark Storer
  Senior Software Engineer
  Cardiff.com
 
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
 
 

> -----Original Message-----
> From: Thomas Hauk [mailto:t...@shaggyfrog.com] 
> Sent: Thursday, May 06, 2010 11:16 AM
> To: itext-questions@lists.sourceforge.net
> Subject: Spam: Re: [iText-questions] Merging two templates in iText
> 
> On May 6, 2010, at 10:46 AM, 1T3XT info wrote:
> > In that case, why don't you just clip both pages in half?
> >
> >> Can you show me a code fragment to demonstrate the above?
> >
> > I don't have the time to make an example, but it should 
> take you less 
> > than an hour to do it yourself.
> >
> >> The documents may contain more than just text. Is it still 
> possible 
> >> in that case?
> >
> > See above: why don't you just clip both pages in half?
> 
> 
> That's just the point. I don't know how to do that. This is 
> why I'm asking the mailing list. I'm asking how I can merge 
> two PDFs into one file.
> 
> Telling me I "demonstrate a lack of understanding of PDF" and 
> asking me "why don't I just do X" is missing the point. I'm 
> coming here seeking knowledge. Not a wrap on the knuckles.
> 
> --
> Thomas Hauk
> Shaggy Frog Software
> www.shaggyfrog.com
> 
> 
> --------------------------------------------------------------
> ----------------
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> 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/
> 
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.814 / Virus Database: 271.1.1/2842 - Release 
> Date: 05/05/10 23:26:00
> 

------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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/

Reply via email to