You've got text outside marked content operators ("These are some famous movies by Stanley > Kubrick:", "This is a movie by Akira Kurosawa: ", etc). IIRC, /everything/ must be properly marked up. And "properly" has a very specific definition.
You really need to buy a copy of the PDF/A spec in order to do "1a" correctly. "1b" isn't all that hard. --Mark Storer Senior Software Engineer Cardiff.com import legalese.Disclaimer; Disclaimer<Cardiff> DisCard = null; > -----Original Message----- > From: myworld.amol [mailto:myworld.a...@gmail.com] > Sent: Tuesday, August 16, 2011 1:53 AM > To: itext-questions@lists.sourceforge.net > Subject: Re: [iText-questions] PDF/A-1a missing structure issue.. > > Hello Jose, > Thanks for your reply. > I tried following example to generate PDF/A-1a compliance PDF > using iText APIs. > > > import java.awt.color.ICC_Profile; > import java.io.FileInputStream; > import java.io.FileOutputStream; > import java.io.IOException; > > import com.lowagie.text.Document; > import com.lowagie.text.DocumentException; > import com.lowagie.text.Image; > import com.lowagie.text.pdf.BaseFont; > import com.lowagie.text.pdf.PdfContentByte; > import com.lowagie.text.pdf.PdfDictionary; > import com.lowagie.text.pdf.PdfName; > import com.lowagie.text.pdf.PdfString; > import com.lowagie.text.pdf.PdfStructureElement; > import com.lowagie.text.pdf.PdfStructureTreeRoot; > import com.lowagie.text.pdf.PdfWriter; > > > > public class ReadOutLoud { > > /** The resulting PDF. */ > public static String RESULT = "D:/read_out_loud.pdf"; > /** A resource that is used in the PDF document. */ > public static String RESOURCE = "E:/hm_pics/0206_181704.jpg"; > > /** > * Creates a PDF document. > * @param filename the path to the new PDF document > * @throws DocumentException > * @throws IOException > */ > public void createPdf(String filename) throws > IOException, DocumentException { > // step 1 > Document document = new Document(); > // step 2 > PdfWriter writer = PdfWriter.getInstance(document, > new FileOutputStream(filename)); > writer.setTagged(); > writer.setUserProperties(true); > writer.setPDFXConformance(writer.PDFA1A); > // step 3 > document.open(); > writer.createXmpMetadata(); > ICC_Profile icc = null; > try{ > icc = ICC_Profile.getInstance(new > FileInputStream("D:/ICC_Profile/sRGB_IEC61966-2-1_black_scaled.icc")); > writer.setOutputIntents("Custom", > "","http://www.color.org", "sRGB IEC61966-2.1", icc); > }catch(IOException e){ > // > } > // step 4 > PdfContentByte cb = writer.getDirectContent(); > BaseFont bf = null; > > try{ > bf = > BaseFont.createFont("E:/Tomcat5/webapps/EQUBE632/BuildNPlay/fo > nts/HELR45W.TTF", > BaseFont.CP1252, BaseFont.EMBEDDED); > > }catch(Exception e){ > eQube.logger.error("Error while > creating basefont for PDFA "+e.getMessage()); > } > BaseFont bf2 = bf; > > PdfStructureTreeRoot root = writer.getStructureTreeRoot(); > PdfStructureElement div = new > PdfStructureElement(root, new PdfName("Div")); > PdfDictionary dict; > > cb.beginMarkedContentSequence(div); > > cb.beginText(); > cb.moveText(36, 788); > cb.setFontAndSize(bf, 12); > cb.setLeading(18); > cb.showText("These are some famous movies by Stanley > Kubrick: "); > dict = new PdfDictionary(); > dict.put(PdfName.E, new PdfString("Doctor")); > cb.beginMarkedContentSequence(new PdfName("Span"), > dict, true); > cb.newlineShowText("Dr."); > cb.endMarkedContentSequence(); > cb.showText(" Strangelove or: How I Learned to Stop > Worrying and Love the Bomb."); > dict = new PdfDictionary(); > dict.put(PdfName.E, new PdfString("Eyes Wide Shut.")); > cb.beginMarkedContentSequence(new PdfName("Span"), > dict, true); > cb.newlineShowText("EWS"); > cb.endMarkedContentSequence(); > cb.endText(); > dict = new PdfDictionary(); > dict.put(PdfName.LANG, new PdfString("en-us")); > dict.put(new PdfName("Alt"), new PdfString("2001: A > Space Odyssey.")); > cb.beginMarkedContentSequence(new PdfName("Span"), > dict, true); > Image img = Image.getInstance(RESOURCE); > img.scaleToFit(1000, 100); > img.setAbsolutePosition(36, 640); > cb.addImage(img); > cb.endMarkedContentSequence(); > > cb.beginText(); > cb.moveText(36, 620); > cb.setFontAndSize(bf, 12); > cb.showText("This is a movie by Akira Kurosawa: "); > dict = new PdfDictionary(); > dict.put(PdfName.ACTUALTEXT, new PdfString("Seven Samurai.")); > cb.beginMarkedContentSequence(new PdfName("Span"), > dict, true); > cb.setFontAndSize(bf2, 12); > cb.showText("\u4e03\u4eba\u306e\u4f8d"); > cb.endMarkedContentSequence(); > cb.endText(); > > cb.endMarkedContentSequence(); > // step 5 > document.close(); > } > /** > * Main method. > * > * @param args no arguments needed > * @throws DocumentException > * @throws IOException > */ > public static void main(String[] args) throws > IOException, DocumentException { > new ReadOutLoud().createPdf(RESULT); > } > } > > > After execution of this program PDF generates > successfully.But again when i try to validate it with > PDFPilot tool to check its complience for PDF/A-1a it gives > me following error. > > http://itext-general.2136553.n4.nabble.com/file/n3746677/PDFA_ > 1A_Problem_example.jpg > > This example is demonstrated on following site. > http://itextpdf.com/examples/iia.php?id=271 > > After trying this example also i am getting above error..Is > there something missing in above example? > Please reply.. > > Thanks > Amol > > > > -- > View this message in context: > http://itext-general.2136553.n4.nabble.com/PDF-A-1a-missing-st ructure-issue-tp3735572p3746677.html > Sent from the iText - General mailing list archive at Nabble.com. > > -------------------------------------------------------------- > ---------------- > uberSVN's rich system and user administration capabilities > and model configuration take the hassle out of deploying and > managing Subversion and the tools developers use with it. > Learn more about uberSVN and get a free download at: > http://p.sf.net/sfu/wandisco-dev2dev > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > iText(R) is a registered trademark of 1T3XT BVBA. > Many questions posted to this list can (and will) be answered > with a reference to the iText book: > http://www.itextpdf.com/book/ Please check the keywords list > before you ask for examples: http://itextpdf.com/themes/keywords.php > > ------------------------------------------------------------------------------ uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php