Difficult, not impossible.

-----Original Message-----
From: fbga81 [mailto:[email protected]] 
Sent: Wednesday, March 10, 2010 12:04 PM
To: [email protected]
Subject: Re: [iText-questions] Embedding fonts when copying PDF


OK, thanks Leonard. Now I understand what you tried to say. So it's almost
impossible to do what I tried, isn't it??

Thanks again.



Leonard Rosenthol-3 wrote:
> 
> But in the documentation for that API call - does it say ANYTHING about in
> impacting the fonts used in IMPORTED pages?  No, it does not.  Because it
> does not.   That API call only applies to NEWLY ADDED text content.
> 
> Embedding fonts that aren't already present is a complex operation that,
> AFAIK, iText does not natively support.  You would need to write some
> fairly low level code, with a detailed understanding of PDF and fonts, to
> make it happen.
> 
> Leonard
> 
> From: Borja Garcia [mailto:[email protected]]
> Sent: Wednesday, March 10, 2010 8:59 AM
> To: Leonard Rosenthol
> Subject: Re: [iText-questions] Embedding fonts when copying PDF
> 
> Hello Leornard,
> 
> Could you please explain me how to reply the message?? I tried it but
> always find this message:
> 
> The following errors were found. Fix them, and submit again:
> 
>  1.  You seem to be top-posting<http://www.caliburn.nl/topposting.html>.
> Don't do that.
> 
> I reply you by mail so you can see it while I find how to reply in the
> page.
> 
> I don't have to find all the ocurrences of non-embedded fonts because I
> know
> that the only font used in the PDF is Arial and that's why I do this:
> 
>>   BaseFont font = BaseFont.createFont("c:\\windows\\fonts\\arial.ttf",
>>   BaseFont.WINANSI, true);
>>   PdfContentByte content = writer.getDirectContent();
>>   content.setFontAndSize(font, 12);
> 
> Leonard Rosenthol <lrosenth <at> adobe.com> writes:
> 
>>
>> What, in the code below, would you think would be responsible for finding
>> all
> occurrences of non-embedded
>> fonts in your imported content and then embedding them?  Is there
>> anything in
> the documentation that would
>> imply that any of these methods - or any other method in iText - would do
>> that?
>>
>> -----Original Message-----
>> From: fbga81 [mailto:fbga81 <at> hotmail.com]
>> Sent: Wednesday, March 10, 2010 5:41 AM
>> To: itext-questions <at> lists.sourceforge.net
>> Subject: [iText-questions] Embedding fonts when copying PDF
>>
>> Hello,
>>
>> I'm triying to copy an existing PDF to make it a PDF/A and I must embed
>> the
>> fonts but I don't get it. I'm doing this:
>>
>> try {
>>   int pageOffset = 0;
>>   ArrayList master = new ArrayList();
>>   Document document = null;
>>   PdfCopy  writer = null;
>>   String outFile = "D:\\tmp\\OUT_PDF.pdf";
>>   FileOutputStream("D:\\tmp\\hello_A1-b.pdf"));
>>   PdfReader reader = new PdfReader("D:\\tmp\\IN_PDF.pdf");
>>   reader.consolidateNamedDestinations();
>>
>>   // we retrieve the total number of pages
>>   int n = reader.getNumberOfPages();
>>
>>   List bookmarks = (List) SimpleBookmark.getBookmark(reader);
>>
>>   if (bookmarks != null)
>>   {
>>     if (pageOffset != 0)
>>       SimpleBookmark.shiftPageNumbers(bookmarks, pageOffset, null);
>>
>>       master.addAll(bookmarks);
>>   }
>>
>>   pageOffset += n;
>>
>>   // 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.setPDFXConformance(PdfCopy.PDFA1B);
>>
>>   PdfDictionary outi = new PdfDictionary(PdfName.OUTPUTINTENT);
>>
>>   outi.put(PdfName.OUTPUTCONDITIONIDENTIFIER,
>>            new PdfString("sRGB IEC61966-2.1"));
>>   outi.put(PdfName.INFO, new PdfString("sRGB IEC61966-2.1"));
>>   outi.put(PdfName.S, PdfName.GTS_PDFA1);
>>
>>   com.itextpdf.text.pdf.ICC_Profile icc =
>>   com.itextpdf.text.pdf.ICC_Profile.getInstance(new
>>                          FileInputStream("D:\\iText\\srgb.profile"));
>>   PdfICCBased ib = new PdfICCBased(icc);
>>
>>   ib.remove(PdfName.ALTERNATE);
>>
>>   // step 3: we open the document
>>   document.open();
>>   //document.add(new Paragraph("ss", f));
>>   BaseFont font = BaseFont.createFont("c:\\windows\\fonts\\arial.ttf",
>>   BaseFont.WINANSI, true);
>>   PdfContentByte content = writer.getDirectContent();
>>   content.setFontAndSize(font, 12);
>>
>>   // step 4: we add content
>>   PdfImportedPage page = null;
>>   float numero = 12;
>>
>>   //writer.getExtraCatalog().put(PdfName.OUTPUTINTENTS, new
>> PdfArray(outi));
>>   //page.setFontAndSize(font2,numero);
>>
>>   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);
>>
>>   if (master.size() > 0)
>>     writer.setOutlines(master);
>>
>>   // step 5: we close the document
>>   document.close();
>>
>> When I do this the filesize increments, but if I look into the properties
>> of the
>> resultant document, the fonts don't seem to be embedded. If anyone can
>> help me I
>> would thank him.
>>
>> ------------------------------------------------------------------------------
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> iText-questions mailing list
>> iText-questions <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> Buy the iText book: http://www.1t3xt.com/docs/book.php
>> 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/
>>
>> ------------------------------------------------------------------------------
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> iText-questions mailing list
>> iText-questions <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> Buy the iText book: http://www.1t3xt.com/docs/book.php
>> 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/
>>
>>
> 
> 
> 
> 
> Félix Borja García Alcalde
> 
> Consultoría e Integración de Aplicaciones
> 
> Avda. de Los Rosales, 42 - Edificio Novosur
> 
> 28021 - Madrid
> [email protected]<mailto:[email protected]>
> 
> Tel. (+34) 91 3849100 - Ext 7234
> www.ibermatica.com<http://www.ibermatica.com/>
> 
> 
> [file:///C:\DOCUME~1\magaalfe\CONFIG~1\Temp\msohtml1\01\clip_image002.gif]
> 
> 
> 
> 
> 
> 
> 
> 
> 
> [file:///C:\DOCUME~1\magaalfe\CONFIG~1\Temp\msohtml1\01\clip_image003.jpg]
> Antes de imprimir este
> e-mail, piense si es necesario hacerlo
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ________________________________
> ¿Te gustaría tener Hotmail en tu móvil Movistar? ¡Es
> gratis!<http://serviciosmoviles.es.msn.com/hotmail/movistar-particulares.aspx>
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> 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 this message in context: 
http://old.nabble.com/Embedding-fonts-when-copying-PDF-tp27848053p27852723.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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/
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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