Can you extrapolate on this? I've pasted the contents of one of the xml
files below.

<?xml version="1.0" encoding="utf-8"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
    <rdf:Description rdf:about="" xmlns:xmp="http://ns.abobe.com/xap/1.0/";>
      <xmp:CreatorTool>Atalasoft DotAnnotate 6.0</xmp:CreatorTool>
      <xmp:CreateDate>
        <![CDATA[2011-05-27T14:19:21]]>
      </xmp:CreateDate>
    </rdf:Description>
    <rdf:Description rdf:about="DotAnnotate Annotations" xmlns:xmp="
http://ns.abobe.com/xap/4.0/";>
      <DocumentResolution>1,1</DocumentResolution>
      <LayerCollection assembly="Atalasoft.DotAnnotate"
namespace="Atalasoft.Annotate.UI">
        <Items type="System.Collections.ArrayList">
          <LayerAnnotation assembly="Atalasoft.DotAnnotate"
namespace="Atalasoft.Annotate.UI">
            <Data assembly="Atalasoft.DotAnnotate"
type="Atalasoft.Annotate.LayerData">
              <CreationTime type="System.String">
                <![CDATA[2011-05-27T14:18:45]]>
              </CreationTime>
              <ModifiedTime type="System.String">
                <![CDATA[2011-05-27T14:19:08]]>
              </ModifiedTime>
              <Location type="System.String">
                <![CDATA[2173.233,868.2012]]>
              </Location>
              <Rotation type="System.Single">0</Rotation>
              <Size type="System.String">
                <![CDATA[330.3535,81.90576]]>
              </Size>
              <Visible type="System.Boolean">True</Visible>
              <CanMove type="System.Boolean">True</CanMove>
              <CanResize type="System.Boolean">True</CanResize>
              <CanRotate type="System.Boolean">False</CanRotate>
              <CanMirror type="System.Boolean">False</CanMirror>
              <CanSelect type="System.Boolean">True</CanSelect>
              <ExtraProperties assembly="System"
type="System.Collections.Specialized.StringCollection" />
              <GroupAnnotation type="System.Boolean">False</GroupAnnotation>
            </Data>
            <Items assembly="Atalasoft.DotAnnotate"
type="Atalasoft.Annotate.UI.AnnotationUICollection">
              <Items type="System.Collections.ArrayList">
                <CustomRectangleAnn assembly="ATK" namespace="ATK">
                  <Data assembly="Atalasoft.DotAnnotate"
type="Atalasoft.Annotate.RectangleData">
                    <CreationTime type="System.String">
                      <![CDATA[2011-05-27T14:19:06]]>
                    </CreationTime>
                    <ModifiedTime type="System.String">
                      <![CDATA[2011-05-27T14:19:08]]>
                    </ModifiedTime>
                    <Location type="System.String">
                      <![CDATA[2173.233,868.2012]]>
                    </Location>
                    <Rotation type="System.Single">0</Rotation>
                    <Size type="System.String">
                      <![CDATA[330.3535,81.90576]]>
                    </Size>
                    <Visible type="System.Boolean">True</Visible>
                    <CanMove type="System.Boolean">True</CanMove>
                    <CanResize type="System.Boolean">True</CanResize>
                    <CanRotate type="System.Boolean">False</CanRotate>
                    <CanMirror type="System.Boolean">False</CanMirror>
                    <CanSelect type="System.Boolean">True</CanSelect>
                    <ExtraProperties assembly="System"
type="System.Collections.Specialized.StringCollection" />
                    <Fill assembly="Atalasoft.DotAnnotate"
type="Atalasoft.Annotate.AnnotationBrush">
                      <ctor type="System.Int32">0</ctor>
                      <Color type="System.Int32">-256</Color>
                    </Fill>
                    <Translucent type="System.Boolean">True</Translucent>
                  </Data>
                  <Tag type="System.String">
                    <![CDATA[Highlight]]>
                  </Tag>
                </CustomRectangleAnn>
              </Items>
            </Items>
          </LayerAnnotation>
        </Items>
      </LayerCollection>
    </rdf:Description>
  </rdf:RDF>
</x:xmpmeta>






On Thu, Jun 16, 2011 at 8:35 PM, Leonard Rosenthol <lrose...@adobe.com>wrote:

> Your problem is that you do NOT want XMP – you want FDF (or XFDF).
>
>
>
> *From:* Benjamin Nutting [mailto:benja...@nutting.info]
> *Sent:* Thursday, June 16, 2011 8:21 PM
> *To:* itext-questions@lists.sourceforge.net
> *Subject:* [iText-questions] iText Open PDF and apply annotations from XML
>
>
>
> Hey everyone,
>
>
>
> I am very stuck on this problem. Have been working on it for a few days. I
> have a PDF and what looks like a standard Adobe XMP annotations XML file. I
> want to open the PDF with iText and put the annotations onto the pdf, and
> save it to the file system. The annotations are what I call overlays. Say
> there is a price for a product, one of our AP reps puts an annotation over
> the price with the correct price. When they save it in the tool it saves the
> regular PDF and the annotations XML file.
>
> Below are my two examples. Any and all help is much appreciated! Thanks in
> advance
> --Ben
>
>
>
> Try #1:
>
> PdfReader reader = new PdfReader("D:\\Temp\\Ann\\
>
> 00005CCB.pdf");
> PdfStamper stamper = new PdfStamper(reader, new
> FileOutputStream("D:\\Temp\\Ann\\ben.pdf"));
>
> File ssaFile = new File("D:\\Temp\\Ann\\00005CCB.xml");
> FileInputStream ssaFIN = new FileInputStream(ssaFile);
> byte ssaFileContent[] = new byte[(int)ssaFile.length()];
> ssaFIN.read(ssaFileContent);
>
> stamper.setXmpMetadata(ssaFileContent);
> stamper.close();
>
>
>
> Try #2:
> Document document = new Document();
>
> File pdfFile = new File("D:\\Temp\\Ann\\00005CCB.pdf");
> File ssaFile = new File("D:\\Temp\\Ann\\00005CCB.ssa");
> String outputFilename = "D:\\Temp\\Ann\\ben.pdf";
> PdfWriter writer = PdfWriter.getInstance(document, new
> FileOutputStream(outputFilename));
> document.open();
> PdfContentByte cb = writer.getDirectContent();
>
> PdfReader reader = new PdfReader("D:\\Temp\\Ann\\00005CCB.pdf");
> int n = reader.getNumberOfPages();
> PdfImportedPage page = null;
> for (int i = 1; i <= n; i++) {
>        document.newPage();
>        page = writer.getImportedPage(reader, i);
>        cb.addTemplate(page, 0, 0);
> }
>
> FileInputStream ssaFIN = new FileInputStream(ssaFile);
> byte ssaFileContent[] = new byte[(int)ssaFile.length()];
> ssaFIN.read(ssaFileContent);
>
> writer.setXmpMetadata(ssaFileContent);
>
> document.close();
>
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-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
>
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-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

Reply via email to