From: Jeremias Maerki Date: Mon, 24 Jul 2006 07:43:19 +0000 (+0000) Subject: Command-line integration of PDF/X support. Generalized the specifying of PDF profiles... X-Git-Tag: fop-0_93~159 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5f07c0f2db4f0575f2fd4df509757163d917f3a6;p=xmlgraphics-fop.git Command-line integration of PDF/X support. Generalized the specifying of PDF profiles (-pdfprofile parameter). Documentation update for PDF/A. Documentation for PDF/X. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@424949 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/site.xml b/src/documentation/content/xdocs/site.xml index 50504c5f4..96b60461f 100644 --- a/src/documentation/content/xdocs/site.xml +++ b/src/documentation/content/xdocs/site.xml @@ -137,6 +137,7 @@ + diff --git a/src/documentation/content/xdocs/trunk/pdfa.xml b/src/documentation/content/xdocs/trunk/pdfa.xml index 0df4d6adb..e0d8ccf8f 100644 --- a/src/documentation/content/xdocs/trunk/pdfa.xml +++ b/src/documentation/content/xdocs/trunk/pdfa.xml @@ -49,16 +49,10 @@ PDF/A-1b is implemented to the degree that FOP supports the creation of the elements described in ISO 19005-1.

-

- There is a restriction with - XMP metadata. If an XMP metadata packet is present in the fo:declarations - element of an FO file, the values from the XMP packet are not synchronized - with the Info PDF object as is mandated by chapter 6.7.3 of the ISO document. - However, if no XMP packet is supplied FOP automatically generates an XMP - packet from the values in the Info PDF object. -

Tests have been performed against jHove and Adobe Acrobat 7.0.7 (Preflight function). + FOP does not validate completely against Apago's PDF Appraiser. Reasons unknown due to + lack of a full license to get a detailed error protocol.

PDF/A-1a is not implemented, yet. This is mostly because of the requirement @@ -68,10 +62,9 @@

Usage (command line)

- If you specify "-pdfa1b" instead of "-pdf" for the output format on the - command line, support for PDF/A-1b is activated. If there is a violation of - one of the validation rules for PDF/A, an error message is presented and the - processing stops. + To activate PDF/A-1b from the command-line, specify "-pdfprofile PDF/A-1b" + as a parameter. If there is a violation of one of the validation rules for + PDF/A, an error message is presented and the processing stops.

@@ -82,7 +75,6 @@ Here's an example:

@@ -110,7 +102,8 @@ Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent); Don't use CMYK images without an ICC color profile. PDF/A doesn't allow mixing color spaces and FOP currently only properly supports the sRGB color space. Please note that FOP embeds a standard sRGB ICC profile (sRGB IEC61966-2.1) as the - primary output intent for the PDF. + primary output intent for the PDF if no other output intent has been specified + in the configuration.
  • Don't use non-RGB colors in SVG images. Same issue as with CMYK images. @@ -128,5 +121,12 @@ Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent);
  • +
    + PDF profile compatibility +

    + The PDF profiles "PDF/X-3:2003" and "PDF/A-1b" are compatible and can both be + activated at the same time. +

    +
    diff --git a/src/documentation/content/xdocs/trunk/pdfx.xml b/src/documentation/content/xdocs/trunk/pdfx.xml new file mode 100644 index 000000000..7a526f8f6 --- /dev/null +++ b/src/documentation/content/xdocs/trunk/pdfx.xml @@ -0,0 +1,135 @@ + + + + + +
    + PDF/X (ISO 15930) + $Revision$ + + + +
    + +
    + Overview + + Support for PDF/X is available beginning with version 0.93. This feature is new and + may not be 100% complete, yet. Feedback is welcome. + +

    + PDF/X is a standard which faciliates prepress digital data exchange using PDF. + Currently, only PDF/X-3:2003 is implemented out of the many different flavours of PDF/X + profiles. PDF/X-3:2003 is documented in + ISO 15930-6:2003(E). + More info on PDF/X can be found on the + PDF/X info site. +

    +
    +
    + Implementation Status +

    + PDF/X-3:2003 is implemented to the degree that FOP supports + the creation of the elements described in ISO 15930-6. +

    +

    + An important restriction of the current implementation is that all normal + RGB colors specified in XSL-FO and SVG are left unchanged in the sRGB color + space (XSL-FO and SVG both use sRGB as their default color space). + There's no conversion to a CMYK color space. Although sRGB is a + calibrated color space, its color space has a different size than a CMYK + color space which makes the conversion a lossy conversion and can lead to + unwanted results. Although the use of the calibrated sRGB has been promoted + for years, print shops usually prefer to convert an sRGB PDF to CMYK prior + to production. Until there's full CMYK support in FOP you will have to + work closely with your print service provider to make sure you get the + intended result. +

    +

    + Tests have been performed against Adobe Acrobat 7.0.7 (Preflight function). + Note that there are bugs in Adobe Acrobat which cause false alarms if both + PDF/A-1b and PDF/X-3:2003 are activated at the same time. +

    +
    +
    + Usage (command line) +

    + To activate PDF/X-3:2003 from the command-line, specify "-pdfprofile PDF/X-3:2003" + as a parameter. If there is a violation of one of the validation rules for + PDF/X, an error message is presented and the processing stops. +

    +
    +
    + Usage (embedded) +

    + When FOP is embedded in another Java application you can set a special option + on the renderer options in the user agent to activate the PDF/A-1b profile. + Here's an example: +

    + +

    + If one of the validation rules of PDF/X is violated, an PDFConformanceException + (descendant of RuntimeException) is thrown. +

    +
    +
    + PDF/X in Action +

    + There are a number of things that must be looked after if you activate a PDF/X + profile. If you receive a PDFConformanceException, have a look at the following + list (not necessarily comprehensive): +

    +
      +
    • + Make sure all (!) fonts are embedded. If you use base 14 fonts (like Helvetica) + you need to obtain a license for them and embed them like any other font. +
    • +
    • + Don't use PDF encryption. PDF/X doesn't allow it. +
    • +
    • + Don't use CMYK images without an ICC color profile. PDF/X doesn't allow mixing + color spaces and FOP currently only properly supports the sRGB color space. However, + you will need to specify an output device profile (usually a CMYK profile) in the + configuration. sRGB won't work here since it's a display device profile, not an + output device profile. +
    • +
    • + Don't use non-RGB colors in SVG images. Same issue as with CMYK images. +
    • +
    • + Don't use EPS graphics with fo:external-graphic. Embedding EPS graphics in PDF + is deprecated since PDF 1.4 and prohibited by PDF/X-3:2003. +
    • +
    • + PDF is forced to version 1.4 if PDF/X-3:2003 is activated. +
    • +
    +
    +
    + PDF profile compatibility +

    + The PDF profiles "PDF/X-3:2003" and "PDF/A-1b" are compatible and can both be + activated at the same time. +

    +
    + +
    diff --git a/src/java/org/apache/fop/cli/CommandLineOptions.java b/src/java/org/apache/fop/cli/CommandLineOptions.java index e0714cfea..d88e73cac 100644 --- a/src/java/org/apache/fop/cli/CommandLineOptions.java +++ b/src/java/org/apache/fop/cli/CommandLineOptions.java @@ -33,8 +33,10 @@ import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.MimeConstants; +import org.apache.fop.pdf.PDFAMode; import org.apache.fop.pdf.PDFEncryptionManager; import org.apache.fop.pdf.PDFEncryptionParams; +import org.apache.fop.pdf.PDFXMode; import org.apache.fop.render.awt.AWTRenderer; import org.apache.fop.render.Renderer; import org.apache.fop.render.pdf.PDFRenderer; @@ -301,6 +303,8 @@ public class CommandLineOptions { i = i + parsePDFOwnerPassword(args, i); } else if (args[i].equals("-u")) { i = i + parsePDFUserPassword(args, i); + } else if (args[i].equals("-pdfprofile")) { + i = i + parsePDFProfile(args, i); } else if (args[i].equals("-noprint")) { getPDFEncryptionParams().setAllowPrint(false); } else if (args[i].equals("-nocopy")) { @@ -397,6 +401,9 @@ public class CommandLineOptions { } else { outfile = new File(args[i + 1]); if (pdfAMode != null) { + if (renderingOptions.get("pdf-a-mode") != null) { + throw new FOPException("PDF/A mode already set"); + } renderingOptions.put("pdf-a-mode", pdfAMode); } return 1; @@ -622,6 +629,33 @@ public class CommandLineOptions { } } + private int parsePDFProfile(String[] args, int i) throws FOPException { + if ((i + 1 == args.length) + || (args[i + 1].charAt(0) == '-')) { + throw new FOPException("You must specify a PDF profile"); + } else { + String profile = args[i + 1]; + PDFAMode pdfAMode = PDFAMode.valueOf(profile); + if (pdfAMode != null && pdfAMode != PDFAMode.DISABLED) { + if (renderingOptions.get("pdf-a-mode") != null) { + throw new FOPException("PDF/A mode already set"); + } + renderingOptions.put("pdf-a-mode", pdfAMode.getName()); + return 1; + } else { + PDFXMode pdfXMode = PDFXMode.valueOf(profile); + if (pdfXMode != null && pdfXMode != PDFXMode.DISABLED) { + if (renderingOptions.get("pdf-x-mode") != null) { + throw new FOPException("PDF/X mode already set"); + } + renderingOptions.put("pdf-x-mode", pdfXMode.getName()); + return 1; + } + } + throw new FOPException("Unsupported PDF profile: " + profile); + } + } + private void setOutputMode(String mime) throws FOPException { if (outputmode == null) { outputmode = mime; @@ -863,21 +897,23 @@ public class CommandLineOptions { "\nUSAGE\nFop [options] [-fo|-xml] infile [-xsl file] " + "[-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] \n" + " [OPTIONS] \n" - + " -d debug mode \n" - + " -x dump configuration settings \n" - + " -q quiet mode \n" - + " -c cfg.xml use additional configuration file cfg.xml\n" - + " -l lang the language to use for user information \n" - + " -r relaxed/less strict validation (where available)\n" - + " -dpi xxx target resolution in dots per inch (dpi) where xxx is a number\n" - + " -s for area tree XML, down to block areas only\n" - + " -v to show FOP version being used\n\n" - + " -o [password] PDF file will be encrypted with option owner password\n" - + " -u [password] PDF file will be encrypted with option user password\n" - + " -noprint PDF file will be encrypted without printing permission\n" - + " -nocopy PDF file will be encrypted without copy content permission\n" - + " -noedit PDF file will be encrypted without edit content permission\n" - + " -noannotations PDF file will be encrypted without edit annotation permission\n\n" + + " -d debug mode \n" + + " -x dump configuration settings \n" + + " -q quiet mode \n" + + " -c cfg.xml use additional configuration file cfg.xml\n" + + " -l lang the language to use for user information \n" + + " -r relaxed/less strict validation (where available)\n" + + " -dpi xxx target resolution in dots per inch (dpi) where xxx is a number\n" + + " -s for area tree XML, down to block areas only\n" + + " -v to show FOP version being used\n\n" + + " -o [password] PDF file will be encrypted with option owner password\n" + + " -u [password] PDF file will be encrypted with option user password\n" + + " -noprint PDF file will be encrypted without printing permission\n" + + " -nocopy PDF file will be encrypted without copy content permission\n" + + " -noedit PDF file will be encrypted without edit content permission\n" + + " -noannotations PDF file will be encrypted without edit annotation permission\n" + + " -pdfprofile prof PDF file will be generated with the specified profile\n" + + " (Examples for prof: PDF/A-1b or PDF/X-3:2003)\n\n" + " [INPUT] \n" + " infile xsl:fo input file (the same as the next) \n" + " -fo infile xsl:fo input file \n" @@ -890,7 +926,7 @@ public class CommandLineOptions { + " outfile input will be rendered as PDF into outfile\n" + " -pdf outfile input will be rendered as PDF (outfile req'd)\n" + " -pdfa1b outfile input will be rendered as PDF/A-1b compliant PDF\n" - + " (outfile req'd)\n" + + " (outfile req'd, same as \"-pdf outfile -pdfprofile PDF/A-1b\")\n" + " -awt input will be displayed on screen \n" + " -mif outfile input will be rendered as MIF (FrameMaker) (outfile req'd)\n" + " -rtf outfile input will be rendered as RTF (outfile req'd)\n"