Thread copied below for reference... I found how to do this. In the build.xml, in the <fop> section of the target, include the parm:
userconfig="./fop.xconf" Then, in the fop.conf file, the following can be added, along with the sections where I have now found, you can specify fonts: <renderer mime="application/pdf"> <encryption-params> <encryption-length>128</encryption-length> <user-password>testuserpass</user-password> <owner-password>testownerpass</owner-password> <noprint/> <nocopy/> <noedit/> <noannotations/> <nofillinforms/> <noaccesscontent/> <noassembledoc/> <noprinthq/> </encryption-params> </renderer>Unfortunately, it doesn't support all command-line options, e.g. -d is not supported, only valid userconfs. The point being, in an ant task, -c can in some cases be replaced by a call to a userconfs file. Thanks, Walter Kruse X---------------------------------------------------------------------snip Mar 09, 2011; 8:09am FOP command-line option in ant task I build PDF from DocBook with Ant in Eclipse. All works well. I want to pass the FOP command line args for -noprint, -nocopy, -noedit and -noannotations. I read about this in the FOP docs under security/encryption (http://xmlgraphics.apache.org/fop/0.95/pdfencryption.html). However, I cannot seem to find how to do this in my Ant build.xml The built-in ant task (http://xmlgraphics.apache.org/fop/0.95/anttask.html) makes provision for indir, outdir etc. parameters. How do I include the FOP command-line options though ? My target is as follows: <target name="build-pdf" depends="depends" description="Generates PDF files from DocBook XML"> <echo message="Running 'build-pdf' at ${timestamp}" /> <echo message="******************************************" /> <xslt style="${fo.stylesheet}" extension=".fo" basedir="${source.dir}" destdir="${fo.dir}"> <classpath refid="xalan.classpath" /> <include name="RubyRecipesForTesters.xml" /> </xslt> <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop"> <classpath> <fileset dir="${fop.home}/lib"> <include name="*.jar" /> </fileset> <fileset dir="${fop.home}/build"> <include name="fop.jar" /> <include name="fop-hyph.jar" /> </fileset> </classpath> </taskdef> <fop format="application/pdf" fofile="${fo.dir}/RubyRecipesForTesters.fo" outfile="${target.dir}/RubyRecipesForTesters.pdf"/> <copy file="${target.dir}/RubyRecipesForTesters.pdf" tofile="${publish.dir}/${pub.dir}/RubyRecipesforTesters.pdf"/> </target> Thanks in advance Walter Kruse Jeremias Maerki-2 Reply | Threaded | More Mar 09, 2011; 11:27am Re: FOP command-line option in ant task The command-line and Ant task are completely different front-ends to FOP. The Ant task did not get as much love as the command-line so may not expose all features offered from the command-line. If you know a bit about Java it should be fairly easy for you to extend the Ant task to expose the features you're missing. We'll gladly consider any patch you post to FOP's Bugzilla. On 09.03.2011 07:09:37 Walter Kruse wrote: > > I build PDF from DocBook with Ant in Eclipse. All works well. > > I > want to pass the FOP command line args for -noprint, -nocopy, -noedit > and -noannotations. I read about this in the FOP docs under > security/encryption > (http://xmlgraphics.apache.org/fop/0.95/pdfencryption.html). However, I > cannot seem to find how to do this in my > Ant build.xml > > The built-in ant task (http://xmlgraphics.apache.org/fop/0.95/anttask.html) > makes provision for indir, outdir > etc. parameters. How do I include the FOP command-line options though ? > > > My target is as follows: > > <target name="build-pdf" depends="depends" > description="Generates PDF files from DocBook XML"> > <echo message="Running 'build-pdf' at ${timestamp}" /> > > <echo message="******************************************" /> > <xslt style="${fo.stylesheet}" extension=".fo" > basedir="${source.dir}" destdir="${fo.dir}"> > > <classpath refid="xalan.classpath" /> > <include name="RubyRecipesForTesters.xml" /> > > </xslt> > <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop"> > > <classpath> > <fileset dir="${fop.home}/lib"> > <include name="*.jar" /> > </fileset> > <fileset dir="${fop.home}/build"> > > <include name="fop.jar" /> > <include name="fop-hyph.jar" /> > </fileset> > </classpath> > </taskdef> > > > > <fop format="application/pdf" > fofile="${fo.dir}/RubyRecipesForTesters.fo" > outfile="${target.dir}/RubyRecipesForTesters.pdf"/> > <copy file="${target.dir}/RubyRecipesForTesters.pdf" tofile="${publish.dir}/${pub.dir}/RubyRecipesforTesters.pdf"/> > > </target> > > Thanks in advance > Walter Kruse > ... [show rest of quote] Jeremias Maerki --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] Peter Hancock-2 Reply | Threaded | More Mar 09, 2011; 11:43am Re: FOP command-line option in ant task In reply to this post by Walter Kruse-2 Hi Walter, Have you tried running FOP from the command line? This is the preferred way to run FOP as a stand alone application. If you can invest a little time to set this up you will be rewarded with the ability to fully configure FOP. If you think you are truly bound to the ant task, then a modest modification to org.apache.fop.tools.anttasks.Fop to parse the properties for the encryption parameters, as suggested by Jeremias. This is handled from the command line arguments by org.apache.fop.cli.CommandLineOptions, which you may want to use for inspiration. Good luck, Peter On Wed, Mar 9, 2011 at 6:09 AM, Walter Kruse <[hidden email]> wrote: > I build PDF from DocBook with Ant in Eclipse. All works well. > > I want to pass the FOP command line args for -noprint, -nocopy, -noedit and > -noannotations. I read about this in the FOP docs under security/encryption > (http://xmlgraphics.apache.org/fop/0.95/pdfencryption.html). However, I > cannot seem to find how to do this in my Ant build.xml > > The built-in ant task (http://xmlgraphics.apache.org/fop/0.95/anttask.html) > makes provision for indir, outdir etc. parameters. How do I include the FOP > command-line options though ? > > My target is as follows: > > <target name="build-pdf" depends="depends" > description="Generates PDF files from DocBook XML"> > <echo message="Running 'build-pdf' at ${timestamp}" /> > <echo message="******************************************" /> > <xslt style="${fo.stylesheet}" extension=".fo" > basedir="${source.dir}" destdir="${fo.dir}"> > <classpath refid="xalan.classpath" /> > <include name="RubyRecipesForTesters.xml" /> > > </xslt> > <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop"> > <classpath> > <fileset dir="${fop.home}/lib"> > <include name="*.jar" /> > </fileset> > <fileset dir="${fop.home}/build"> > <include name="fop.jar" /> > <include name="fop-hyph.jar" /> > </fileset> > </classpath> > </taskdef> > > > <fop format="application/pdf" > fofile="${fo.dir}/RubyRecipesForTesters.fo" > outfile="${target.dir}/RubyRecipesForTesters.pdf"/> > <copy file="${target.dir}/RubyRecipesForTesters.pdf" > tofile="${publish.dir}/${pub.dir}/RubyRecipesforTesters.pdf"/> > </target> > > Thanks in advance > Walter Kruse > ... [show rest of quote] --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email]