You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vm...@apache.org on 2003/04/14 19:27:02 UTC

cvs commit: xml-fop/src/documentation/content/xdocs faq.xml output.xml

vmote       2003/04/14 10:27:02

  Modified:    src/documentation/content/xdocs faq.xml output.xml
  Log:
  Move pdf-specific content from faq.xml to output.xml.
  
  Revision  Changes    Path
  1.22      +5 -92     xml-fop/src/documentation/content/xdocs/faq.xml
  
  Index: faq.xml
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/documentation/content/xdocs/faq.xml,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- faq.xml	14 Apr 2003 16:40:44 -0000	1.21
  +++ faq.xml	14 Apr 2003 17:27:01 -0000	1.22
  @@ -802,22 +802,7 @@
       <faq id="pdf-postprocess">
         <question>What tools are available for post-processing my PDF document?</question>
         <answer>
  -        <ul>
  -          <li>
  -            The most popular one that we are aware of is <link
  -              href="http://www.lowagie.com/iText">iText</link>, which has tools
  -            for adding security features, document properties, watermarks, and
  -            many other features to PDF files. FOP and iText can be integrated
  -            into one Java application, see sample code for <link
  -              href="#pdf-security">encryption</link>.
  -            The bad news is that iText swallows PDF bookmarks.
  -          </li>
  -
  -          <li>
  -            You can use Adobe Acrobat (the full version, not the Reader) to
  -            process the file manually or with scripting that it supports.
  -          </li>
  -        </ul>
  +        <p>See <link href="output.html#pdf-postprocess">PDF Post-processing</link>.</p>
         </answer>
       </faq>
       <faq id="pdf-security">
  @@ -825,59 +810,8 @@
         to my PDF document?</question>
         <answer>
           <p>
  -          FOP does not currently support this feature. Possible workarounds
  -          include those mentioned in the <link href="#PDF-postprocess">PDF
  -            Post-Processing FAQ</link>.
  -        </p>
  -        <p>
  -          Some sample code for encrypting a FOP generated PDF with iText to
  -          get you started:
  -        </p>
  -        <source><![CDATA[public static void main(String args[]) {
  -  try {
  -    ByteArrayOutputStream fopout=new ByteArrayOutputStream();
  -    FileOutputStream outfile=new FileOutputStream(args[2]);
  -    Driver driver =new Driver();
  -    driver.setOutputStream(fopout);
  -    driver.setRenderer(Driver.RENDER_PDF);
  -    Transformer transformer=TransformerFactory
  -      .newInstance().newTransformer(new StreamSource(new File(args[1])));
  -    transformer.transform(new StreamSource(new File(args[0])),
  -       new SAXResult(driver.getContentHandler()));
  -    PdfReader reader = new PdfReader(fopout.toByteArray());
  -    int n = reader.getNumberOfPages();
  -    Document document = new Document(reader.getPageSizeWithRotation(1));
  -    PdfWriter writer = PdfWriter.getInstance(document, outfile);
  -    writer.setEncryption(PdfWriter.STRENGTH40BITS, "pdf", null,
  -      PdfWriter.AllowCopy);
  -    document.open();
  -    PdfContentByte cb = writer.getDirectContent();
  -    PdfImportedPage page;
  -    int rotation;
  -    int i = 0;
  -    while (i < n) {
  -      i++;
  -      document.setPageSize(reader.getPageSizeWithRotation(i));
  -      document.newPage();
  -      page = writer.getImportedPage(reader, i);
  -      rotation = reader.getPageRotation(i);
  -      if (rotation == 90 || rotation == 270) {
  -        cb.addTemplate(page, 0, -1f, 1f, 0, 0,
  -         reader.getPageSizeWithRotation(i).height());  }
  -      else {
  -        cb.addTemplate(page, 1f, 0, 0, 1f, 0, 0);
  -      }
  -      System.out.println("Processed page " + i);
  -    }
  -    document.close();
  -  }
  -  catch( Exception e) {
  -    e.printStackTrace();
  -  }
  -}]]></source>
  -        <p>
  -          Check the iText tutorial and documentation for setting access flags,
  -          password, encryption strength and other parameters.
  +          See <link href="pdfencryption.html">PDF Encryption</link>.
  +          See also <link href="output.html#pdf-postprocess">PDF Post-processing</link>.
           </p>
         </answer>
       </faq>
  @@ -885,34 +819,13 @@
         <question>How do I add document properties (title, author, etc.) to my
         PDF document?</question>
         <answer>
  -        <p>FOP does not currently support this feature. Possible workarounds
  -        include those mentioned in the <link href="#PDF-postprocess">PDF
  -        Post-Processing FAQ</link>.</p>
  +        <p>See <link href="output.html#pdf-postprocess">PDF Post-processing</link>.</p>
         </answer>
       </faq>
       <faq id="pdf-watermark">
         <question>How do I add watermarks to my PDF document?</question>
         <answer>
  -        <p>FOP does not currently support this feature. Possible
  -        workarounds:</p>
  -        <ul>
  -          <li>
  -            Use a background image for the body region.
  -          </li>
  -          <li>
  -            See the <link href="#PDF-postprocess">PDF Post-Processing
  -              FAQ</link>.
  -          </li>
  -          <li>
  -            (submitted by Trevor_Campbell@kaz.com.au) Place an image in a
  -            region that overlaps the flowing text. For example, make
  -            region-before large enough to contain your image. Then include a
  -            block (if necessary, use an absolutely positioned block-container)
  -            containing the watermark image in the static-content for the
  -            region-before. Note that the image will be drawn on top of the
  -            normal content.
  -          </li>
  -        </ul>
  +        <p>See <link href="output.html#pdf-watermark">PDF Watermarks</link>.</p>
         </answer>
       </faq>
       <faq id="pdf-print-contortion">
  
  
  
  1.10      +78 -4     xml-fop/src/documentation/content/xdocs/output.xml
  
  Index: output.xml
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/documentation/content/xdocs/output.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- output.xml	7 Apr 2003 14:42:07 -0000	1.9
  +++ output.xml	14 Apr 2003 17:27:01 -0000	1.10
  @@ -62,7 +62,7 @@
   </section>
   <section id="pdf">
     <title>PDF</title>
  -    <p>
  +  <p>
   PDF is the best supported output format. It is also the most accurate
   with text and layout. This creates a PDF document that is streamed out
   as each page is rendered. This means that the internal page index
  @@ -70,8 +70,10 @@
   The PDF version supported is 1.3 which is currently the most popular
   version for Acrobat Reader (4.0), PDF versions are forwards/backwards
   compatible.
  -    </p>
  -    <anchor id="pdf-fonts"/>
  +  </p>
  +  <p>Note that FOP does not currently support "tagged pdf".</p>
  +  <section id="pdf-fonts">
  +    <title>Fonts</title>
       <p>
         PDF has a set of fonts that are always available to all PDF viewers,
         to quote from the PDF Specification:
  @@ -83,7 +85,79 @@
   Dingbats). These fonts, or suitable substitute fonts with the same metrics, are
   guaranteed to be available in all PDF viewer applications."</em>
       </p>
  -    <p>Note that FOP does not currently support "tagged pdf".</p>
  +  </section>
  +  <section id="pdf-postprocess">
  +    <title>Post-processing</title>
  +    <p>FOP does not currently support several desirable PDF features: document properties (title, author, etc.), and watermarks. One workaround is to use Adobe Acrobat (the full version, not the Reader) to process the file manually or with scripting that it supports.</p>
  +    <p>Another popular post-processing tool is <link href="http://www.lowagie.com/iText">iText</link>, which has tools for adding security features, document properties, watermarks, and many other features to PDF files.
  +    </p>
  +    <warning>Caveat: iText swallows PDF bookmarks.</warning>
  +    <p>Here is some sample code that uses iText to encrypt a FOP-generated PDF. (Note that FOP now supports <link href="pdfencryption.html">PDF encryption</link>. However the principles for using iText for other PDF features are similar.)</p>
  +    <source><![CDATA[public static void main(String args[]) {
  +  try {
  +    ByteArrayOutputStream fopout=new ByteArrayOutputStream();
  +    FileOutputStream outfile=new FileOutputStream(args[2]);
  +    Driver driver =new Driver();
  +    driver.setOutputStream(fopout);
  +    driver.setRenderer(Driver.RENDER_PDF);
  +    Transformer transformer=TransformerFactory
  +      .newInstance().newTransformer(new StreamSource(new File(args[1])));
  +    transformer.transform(new StreamSource(new File(args[0])),
  +       new SAXResult(driver.getContentHandler()));
  +    PdfReader reader = new PdfReader(fopout.toByteArray());
  +    int n = reader.getNumberOfPages();
  +    Document document = new Document(reader.getPageSizeWithRotation(1));
  +    PdfWriter writer = PdfWriter.getInstance(document, outfile);
  +    writer.setEncryption(PdfWriter.STRENGTH40BITS, "pdf", null,
  +      PdfWriter.AllowCopy);
  +    document.open();
  +    PdfContentByte cb = writer.getDirectContent();
  +    PdfImportedPage page;
  +    int rotation;
  +    int i = 0;
  +    while (i < n) {
  +      i++;
  +      document.setPageSize(reader.getPageSizeWithRotation(i));
  +      document.newPage();
  +      page = writer.getImportedPage(reader, i);
  +      rotation = reader.getPageRotation(i);
  +      if (rotation == 90 || rotation == 270) {
  +        cb.addTemplate(page, 0, -1f, 1f, 0, 0,
  +         reader.getPageSizeWithRotation(i).height());  }
  +      else {
  +        cb.addTemplate(page, 1f, 0, 0, 1f, 0, 0);
  +      }
  +      System.out.println("Processed page " + i);
  +    }
  +    document.close();
  +  }
  +  catch( Exception e) {
  +    e.printStackTrace();
  +  }
  +}]]></source>
  +    <p>Check the iText tutorial and documentation for setting access flags, password, encryption strength and other parameters.
  +    </p>
  +  </section>
  +  <section id="pdf-watermark">
  +    <title>Watermarks</title>
  +    <p>
  +      In addition to the <link href="#pdf-postprocess">PDF Post-processing</link> options, consider the following workarounds:
  +    </p>
  +    <ul>
  +      <li>
  +        Use a background image for the body region.
  +      </li>
  +      <li>
  +        (submitted by Trevor_Campbell@kaz.com.au) Place an image in a
  +        region that overlaps the flowing text. For example, make
  +        region-before large enough to contain your image. Then include a
  +        block (if necessary, use an absolutely positioned block-container)
  +        containing the watermark image in the static-content for the
  +        region-before. Note that the image will be drawn on top of the
  +        normal content.
  +      </li>
  +    </ul>
  +  </section>
   </section>
   <section id="pcl">
     <title>PCL</title>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org