You can do that with PdfSmartCopy but note that if the fonts are subset you'll gain nothing.
Paulo > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Henrik Hinteregger > Sent: Thursday, May 24, 2007 2:34 PM > To: [email protected] > Subject: [iText-questions] Font mapping when bundeling pdffiles! > > Hi > > I have a problem when I try to bundle several (almost > similar) pdffiles into > 1 pdffile! > The problem is that each pdffile has an integrated font, that > when bundeling > is interpret as a new font instead of one of the already read. > So if I bundel 100 pdffiles, then I get one pdffile with 100 > fonts (that > could be the same) > > I would like to list all of the fonts that I get when reading > the pdffiles > and then map the ones that are the same to a new font that > then is being > used in the bundled pdffile! > > Is thist possible? > > Here is the code that I use! > > ******************************** > import java.io.FileOutputStream; > import java.util.ArrayList; > import java.util.List; > > import com.lowagie.text.Document; > import com.lowagie.text.pdf.PRAcroForm; > import com.lowagie.text.pdf.PdfCopy; > import com.lowagie.text.pdf.PdfImportedPage; > import com.lowagie.text.pdf.PdfReader; > import com.lowagie.text.pdf.SimpleBookmark; > > > public class c2 { > > > public static void main(String args[]) { > if (args.length < 2) { > System.err.println("arguments: file1 [file2 ...] > destfile"); > } > else { > System.out.println("PdfCopy example"); > try { > int pageOffset = 0; > ArrayList master = new ArrayList(); > int f = 0; > String outFile = args[args.length-1]; > Document document = null; > PdfCopy writer = null; > while (f < args.length-1) { > // we create a reader for a certain document > PdfReader reader = new PdfReader(args[f]); > reader.consolidateNamedDestinations(); > // we retrieve the total number of pages > int n = reader.getNumberOfPages(); > List bookmarks = > SimpleBookmark.getBookmark(reader); > if (bookmarks != null) { > if (pageOffset != 0) > > SimpleBookmark.shiftPageNumbers(bookmarks, > pageOffset, null); > master.addAll(bookmarks); > } > pageOffset += n; > > if (f == 0) { > // step 1: creation of a document-object > document = new > Document(reader.getPageSizeWithRotation(1)); > // step 2: we create a writer that > listens to the > document > writer = new PdfCopy(document, new > FileOutputStream(outFile)); > // step 3: we open the document > document.open(); > } > // step 4: we add content > PdfImportedPage page; > for (int i = 0; i < n; ) { > ++i; > page = writer.getImportedPage(reader, i); > writer.addPage(page); > } > PRAcroForm form = reader.getAcroForm(); > if (form != null) > writer.copyAcroForm(reader); > f++; > } > if (!master.isEmpty()) > writer.setOutlines(master); > // step 5: we close the document > document.close(); > } > catch(Exception e) { > e.printStackTrace(); > } > } > } > } > ************************* > > _________________________________________________________________ > Del dine store filer uden problemer på MSN Messenger: > http://messenger.msn.dk/ > > > Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ 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/
