Sumeet Gupta wrote:
> 
> 
> 1T3XT info wrote:
>> 
>> Sumeet Gupta wrote:
>>> hi,
>>> 
>>> I have generated a PDF using iText version 2.0.8. However, i want to
>>> know as
>>> to which PDF standard does this PDF conform to.
>> 
>> Thanks Bruno, I need to adhere to PDF/A. When i did some more search, i
>> came across
>> http://article.gmane.org/gmane.comp.java.lib.itext.general/31582/.
>> However, when i added the mentioned code snippet into my code, I am still
>> getting the same error :-
>> 
>> DocumentException: com.lowagie.text.pdf.PdfXConformanceException: All the
>> fonts must be embedded.
>> 
>> The following is my code snippet:-
>> 
>>                      writer = PdfWriter.getInstance(document, baosPDF);
>>                      writer.setPDFXConformance(PdfWriter.PDFA1A);
>> 
>>                      document.open();
>>                      
>>                      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);
>>                      ICC_Profile icc = ICC_Profile.getInstance(new
>> FileInputStream("C:\\srgb.profile"));
>>                      PdfICCBased ib = new PdfICCBased(icc);
>>                      ib.remove(PdfName.ALTERNATE);
>>                      outi.put(PdfName.DESTOUTPUTPROFILE,
>> writer.addToBody(ib).getIndirectReference());
>>                      writer.getExtraCatalog().put(PdfName.OUTPUTINTENTS, new
>> PdfArray(outi));
>> 
>>                      BaseFont bf = 
>> BaseFont.createFont("c:\\windows\\fonts\\arial.ttf",
>> BaseFont.WINANSI, true);
>>                      Font f = new Font(bf, 12);
>> ......
>> ......
>> .....// adding the contents to the pdf
>> 
>> 
>> document.close(); 
>> 
>> I have ensured that both sgrb.profile and arial.ttf files are present at
>> the locations mentioned. I am still getting the exception as above. Any
>> pointers to anything that i may have missed here?
>> 
>> Does having PDF version 1.4 mean that the PDF is automatically PDF/A
>> compliant?
>> 
>> 
>> Thanks a lot. I could find the reason for getting the exception. I am
>> actually using a table to print the PDF. The method takes a HashMap (with
>> key and value pairs) and returns a PDFTable with 2 columns - one each for
>> the key and value. When i add this PDFTable to the document, I get the
>> PDFConformanceException. It means that when i add cells to the table, it
>> is not using the embedded fonts by default. How do i force the table to
>> use the fonts specified by me? The following is the code snippet:-
>> 
>>      private Table makeTableFromMap(final Map map, final String component)
>>      {
>>              Table tab = null;
>>              tab = new Table(NUMBER_OF_COLUMNS);
>>              tab.setBorderWidth(1.0f);
>>              tab.setPadding(1);
>>              tab.setSpacing(0);
>> 
>>              String fieldName = component + " Field";
>>              String fieldValue = component + " Value";
>>              Paragraph fieldNamePara = new Paragraph(fieldName, grayFont);
>>              Paragraph fieldValuePara = new Paragraph(fieldValue, grayFont);
>>                      
>>              tab.addCell(new Cell(fieldNamePara));
>>              tab.addCell(new Cell(fieldValuePara));
>>                      
>>              tab.endHeaders();
>> 
>>              if (map.keySet().size() == 0)
>>              {
>>                      Cell c = new Cell("none");
>>                      c.setColspan(2);
>>                      tab.addCell(c);
>>              }
>>              else
>>              {
>>                      Iterator iter = map.keySet().iterator();
>>                      while (iter.hasNext())
>>                      {
>>                              Cell valueCell = null;
>>                              String strName = (String) iter.next();
>>                              Object value = map.get(strName);
>>                              String strValue = null;
>>                              if (value == null)
>>                              {
>>                                      strValue = "";
>>                              }
>>                              else
>>                              {
>>                                      strValue = value.toString();
>>                              }
>>                              tab.addCell(new Cell(strName));
>>                              if(null == valueCell)
>>                              {
>>                                      tab.addCell(new Cell(strValue));        
>>                              }
>>                              else
>>                              {
>>                                      tab.addCell(valueCell);
>>                              }
>>                      }
>>              }
>>      }
>>      catch(BadElementException bex)
>>      {
>>                           bex.printStackTrace();             
>>              }
>>      return tab;
>> }
>> 
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> iText-questions mailing list
>> iText-questions@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>> 
>> Do you like iText?
>> Buy the iText book: http://www.1t3xt.com/docs/book.php
>> Or leave a tip: https://tipit.to/itexttipjar
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/What-is-the-difference-between-PDF-A-and-PDF-X--tp18458617p18684602.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to