There are MANY tools available for validating PDF/A - the most common
being Adobe Acrobat Professional...
Leonard
On Oct 28, 2008, at 8:04 PM, Rai wrote:
>
> Hi,
>
> I am using iText for generating PDF/A compliant pdf file. The code
> used by
> me is as follows:
>
> public class PdfMaker
> {
> // the _document is the PDF file's layout
> private Document _document;
>
> // the writer used to write to the _document to produce the PDF file
> private PdfWriter _writer;
>
> // the output stream to write to the file
> private ByteArrayOutputStream _baosPDF;
>
> // empty space between two tables, headings, etc
> private Paragraph _emptyPara;
>
> // Common constants
> private static final String REPORT_HEADING = "REPORT";
> private static final String FILE_EXTENSION = ".pdf";
> private static final String TIME_PATTERN = "mmddyyyy_HHmmss";
> private static final String FOOTER = "footer";
>
> private static final String ITEM1 = "Item1";
> private static final String ITEM2 = "Item2";
> private static final String ITEM3 = "Item3";
>
>
> /**
> * This method initializes the components required for generating
> the PDF
> */
> private void init()
> {
> _document = new Document();
> _baosPDF = new ByteArrayOutputStream();
>
>
> try
> {
> _writer = PdfWriter.getInstance(_document, _baosPDF);
> _writer.setPDFXConformance(PdfWriter.PDFA1A);
> }
> catch (DocumentException dex)
> {
>
> }
> }
>
> /**
> * This method creates the PDF
> * @return File representation of the PDF generated
> */
> public File createPDF()
> {
>
> File pdfFile = null;
> init();
> //File fontFile = createFontFile();
>
> try
> {
> _document.setPageSize(PageSize.A4);
> _document.open();
> BaseFont bf =
> BaseFont.createFont("C:\\WINDOWS\\Fonts\\ARIAL.TTF",
> BaseFont.WINANSI, true);
>
> Font font = new Font(bf, 12);
>
> _emptyPara = new Paragraph(" ", font);
>
> // set the footer
> HeaderFooter footer = new HeaderFooter(new
> Phrase(FOOTER, font),
> false);
> footer.setAlignment(2);
> _document.setFooter(footer);
>
> Paragraph title = new Paragraph(REPORT_HEADING, font);
> title.setAlignment(1);
> _document.add(title);
>
> _document.add(_emptyPara);
>
> // General Details
> addParagraphHeader("General", font);
> addGeneralDetails(font);
>
>
> _document.close();
> StringBuffer pdfFileName = new StringBuffer();
> SimpleDateFormat simpleDateFormat = new
> SimpleDateFormat(TIME_PATTERN);
> String dateAndTimeSuffix = simpleDateFormat.format(new
> Date());
> pdfFileName.append("_");
> pdfFileName.append(dateAndTimeSuffix);
> pdfFile = File.createTempFile(pdfFileName.toString(),
> FILE_EXTENSION);
>
> _baosPDF.writeTo(new FileOutputStream(pdfFile));
>
> _writer.close();
> }
> catch(IOException ioe)
> {
>
> }
> catch(DocumentException docex)
> {
>
> }
> finally
> {
>
> }
> return pdfFile;
> }
>
> /**
> * This method adds a paragraph to the PDF
> * @param paragraphName : the name of the Paragraph
> */
> private void addParagraphHeader(final String paragraphName, final
> Font
> font) throws DocumentException
> {
> Paragraph generalPara = new Paragraph(paragraphName, font);
> generalPara.setAlignment(1);
> _document.add(generalPara);
> _document.add(_emptyPara);
> }
>
> /**
> * This method adds the General details of the workitem to the PDF
> in a
> tabular form
> * @throws DocumentException : an iText specific Runtime Exception
> */
> private void addGeneralDetails(final Font font) throws
> DocumentException
> {
> String item1 = "Item 1";
> String item2 = "Item 2";
> String item3 = "Item 3";
>
> _document.add(new Paragraph("Item 1 : " + item1, font));
> _document.add(new Paragraph("Item 2 : " + item2, font));
> _document.add(new Paragraph("Item 3 : " + item3, font));
>
> }
>
>
> public static void main(String args[])
> {
> PdfMaker pdfMaker = new PdfMaker();
> pdfMaker.createPDF();
> }
> }
>
>
>
> Please let me know if there is any tool available to test the
> compliance of
> the generated pdf file.
>
> Thanks
> Manoj
> --
> View this message in context:
> http://www.nabble.com/Tool-for-testing-PDF-A-compliant-pdf-file-tp20205950p20205950.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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
>
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php