|
I have 30 documents that I am concatinating. I
need
to embed the fonts but I would rather do it only to the final document than
each
individual.
Using the code below, is it possible
to embed the Arial font to the final concatinated
document?
Thank you,
LWC
ByteArrayOutputStream baosPDF = new ByteArrayOutputStream(); // try
{
Document document = null; PdfCopy writer = null; for(int f = 0; f < file_list.size(); f++) { // we create a reader for a certain document PdfReader reader = new PdfReader((String)file_list.get(f)); reader.consolidateNamedDestinations(); reader.shuffleSubsetNames(); // we retrieve the total number of pages int n = reader.getNumberOfPages(); System.out.println("There are " + n + " pages in " + (String)file_list.get(f)); 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)); writer = new PdfCopy(document, baosPDF); // 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); System.out.println("Processed page " + i); } /* PRAcroForm form = reader.getAcroForm(); if (form != null) writer.copyAcroForm(reader);*/ // f++; } // step 5: we close the document document.close(); } catch(Exception e) { e.printStackTrace(); } response.setContentType("application/pdf"); ServletOutputStream sos; sos = response.getOutputStream(); baosPDF.writeTo(sos); sos.flush(); %> </body> </html> "MMS <safeway.com>" made the following annotations. |
- [iText-questions] Embedding fonts Steven Burg
- RE: [iText-questions] Embedding fonts Paulo Soares
- RE: [iText-questions] Embedding fonts Luke Chambers
- RE: [iText-questions] Embedding fonts Paulo Soares
