[XeTeX] Σχετ: Plain XeTeX, pdftitle, pdfinfo

Ross Moore ross.moore at mq.edu.au
Mon Jul 11 05:08:05 CEST 2016


Hi Phil,

On Jul 11, 2016, at 3:40 AM, Philip Taylor <P.Taylor at Rhul.Ac.Uk<mailto:P.Taylor at Rhul.Ac.Uk>> wrote:

Just to summarise (for the benefit of archives and posterity), the following is /almost/ sufficient to achieve PDF/X-1A:2003 compliance using plain XeTeX.

I note the /almost/.   :-)

Full compliance can be achieved using Adobe Acrobat.

Of course. Using the “Preflight” utility in modern Acrobat Pro, you can do just about
anything with PDFs, for standards compliance and compatibility.

The big problem is to do it entirely within TeX-related software,
*without* using Acrobat Pro, except for checking that you’ve done it right.

In reality, creating PDF/X-compliant documents is significantly more involved
than what you have achieved so far.


\newif \ifpdfxa
\pdfxatrue

\ifpdfxa
    \special {pdf: put @thispage << /ArtBox [0 0 498.89641 708.65968] >>}
    \special {pdf: put @thispage << /BleedBox [0 0 498.89641 708.65968] >>}
    \special {pdf: put @thispage << /CropBox [0 0 498.89641 708.65968] >>}
    \special {pdf: put @thispage << /MediaBox [0 0 498.89641 708.65968] >>}
    \special {pdf: put @thispage << /TrimBox [0 0 498.89641 708.65968] >>}
    \special {pdf: docinfo << /GTS_PDFXVersion (PDF/X-1:2001) /GTS_PDFXConformance (PDF/X-1a:2001) >>}
    \special {pdf: put @catalog << /PageMode /UseNone /OutputIntents [ << /Info (none) /Type /OutputIntent /S /GTS_PDFX /OutputConditionIdentifier (Custom) /RegistryName (<http://www.color.org/>http://www.color.org/) >> ] >>}
    \special {pdf: dest (page.1) [@thispage /XYZ @xpos @ypos null]}
    \special {pdf: docinfo << /Title(Document Title)/Subject(Some subject)/Creator(XeTeX)/ModDate(D:yyyymmddhhmmss)/Author(Your Name)/Producer(XeTeX version)/Keywords(Whatever)/Trapped/False >>}
\fi

Using this there are several deficiencies.

1.  You should drop the  /ArtBox  completely.
      PDF/X allows  /ArtBox  or /TrimBox  but *not both* (even if they are set to be the same).
     Some applications require the /TrimBox, so this figures to be the best choice.

2.  PDF/X-1a  doesn’t like compressed object streams.
     There is a command-line switch:   xdvipdfmx -z 0  .
     But it results in a much larger file size in a real-world document.
     Besides, with a document based on your example, and using this switch,
     I cannot get Acrobat to stop complaining about compressed object streams,
     even though the page stream is clearly not compressed:

5 0 obj
<</Length 117>>
stream
 q 1 0 0 1 72 769.89 cm BT /F1 9.9626 Tf 19.925 -9.963 Td[(Hello)-333(W)82(orld!)]TJ 211.584 -654.747 Td[(1)]TJ ET Q

endstream

Fonts in that PDF do use compression.
The only other thing compressed is the XRef table.
When Acrobat is asked to convert to PDF/X the  xref table is uncompressed;
so that figures to be the real issue here.

Pity there is no free online PDF/X validator, like there are for PDF/A, to see what it might say.
In any case, we need to be able to stop  xdvipdfmx  from producing a compressed XRef table.


3.  Your OutputIntent with  /Info(None)  and  /OutputConditionIdentifier (Custom)
     is of no use to anybody or anything.  I’m surprised Acrobat doesn’t flag this.

     You need to include a real ICC color profile (usually CMYK for PDF/X) which is
     typically at least .5 MByte in size, often much larger.

     Upon checking for PDF/X-4 and higher levels, this *is* flagged as an issue.


4.  The  \special {pdf: docinfo << … }   while valid, is *not* the recommended way to
     provide Metadata.
     The modern way is via  XMP which is an XML stream using uncompressed UTF-8 encoding.
     Some  docinfo  fields can be included also, provided they agree *exactly* with what
     is in the XMP packet.  For things like multiple authors, and more than one Keyword entry,
     it is best to put them into the XMP *only*.

     Again, with PDF/X-4 and higher, this is flagged as an issue.


All of these issues are addressed, also for XeLaTeX, in the latest version (1.5.8)
of the  pdfx  LaTeX package.
         https://www.ctan.org/pkg/pdfx?lang=en

The package itself implements everything, (including ensuring that the correct color spaces are used)
and the documentation explains how to specify the (external) Metadata that you may wish to provide.
It has a sub-section discussing the limitations when using XeTeX as engine.

Although a LaTeX package, you can check the source coding to find out how issues
are addressed. Look in particular for  \ifxetex  sections.
Most of the coding is straightforward TeX macro programming.
Though it does use LaTeX’s \IfFileExists  construction, to check that appropriate resources
are available.
(And it loads  hyperref  to get access to some of its features, but also to cancel some
 other features that might conflict with how  pdfx  is handling the Metadata.)



The caveats are as follows :

  1.  a hook will need to be inserted into \shipout to insert the bounding boxes on each page;

  pdfx.sty  uses    \RequirePackage{everyshi}  and  \EveryShipout   for this.
                It’s perhaps a bit of overkill, but a standard way to patch  \shipout .

  1.  the colours will need to be converted to the desired output profile using Adobe Acrobat;

pdfx.sty  uses the  xcolor  package to handle this.
               Once a Color Profile is declared (either CMYK or RGB) the appropriate options
               are prepared for  xcolor  then the package is loaded with these options.
               Internal macros are rigged to stop changes being made, if the author tries to
               load the package separately. Similarly if  color  was loaded before  pdfx ,
               then appropriate coding imposes the correct color space.

               The upshot of this is that whenever a color is requested by name (‘blue’, ‘red’,
                ‘green’, ‘magenta’, etc.) then the correct color space coordinates are used.
                Also, if a new color is declared (say as RGB) but the color model is CMYK,
                then a conversion is done on the declaration, giving CMYK coords when that
                new color is used.


  1.  the file will need to be reduced in size with Acrobat 4+ compatibility but with no image compression in order to convert it to PDF 1.3;

     Not sure of the specifics of this.
     Can anyone provide example documents?
     If this is really an issue, does  xdvipdfmx  have command-line options
     which allow specifying what can be compressed and what not?
     I don’t think so.

    Such control is needed also to have uncompressed XMP Metadata
    but compressed content streams, in all flavors/levels of PDF/A.
    This is something that is highly desirable.

      pdftex and luatex already do this right, as also will Ghostscript when v9.20 emerges
    from pre-release status.
    The next version (1.5.9) of  pdfx.sty  will fully support  latex+dvips+GS  using this.


  1.  the dimensions of the bounding boxes are for B5 in so-called "big points" (Postscript points) and will need to be amended for other page sizes;

     Setting these as a constant for all pages figures to be OK for most documents.
     Even better might be to reset to the size of each box being shipped-out.

     Since this can actually be done bypassing the \output  routine, then it
     requires patching  \shipout  rather than \makeheader  or similar.
     This is certainly an issue for further discussion.


  1.  \setboundingboxes will have to be called explicitly for the first page only.

\shipout can be hooked as follows :

    \def \setboundingboxes
        {%
            \special {pdf: put @thispage << /ArtBox [0 0 498.89641  708.65968] >>}%
            \special {pdf: put @thispage << /BleedBox [0 0 498.89641  708.65968] >>}%
            \special {pdf: put @thispage << /CropBox [0 0 498.89641  708.65968] >>}%
            \special {pdf: put @thispage << /MediaBox [0 0 498.89641  708.65968] >>}%
            \special {pdf: put @thispage << /TrimBox [0 0 498.89641  708.65968] >>}%
        }

Yes, (w/o /ArtBox ); but if you are hooking into  \shipout ,
why not measure the size of the box being shipped?
Do the conversion into actual points.
Will the bottom-left corner always be at  [0 0] ?
Probably need to look also at  \hoffset  and  \voffset .



    \newcount \maxpage
    \maxpage = <whatever>
    \let \Shipout = \shipout
    \def \shipout {\ifnum \pageno < \maxpage \setboundingboxes \fi \Shipout}
--
<Signature.jpg>
Philip Taylor


Hope this helps,

Ross


Dr Ross Moore

Mathematics Dept | Level 2, S2.638 AHH
Macquarie University, NSW 2109, Australia

T: +61 2 9850 8955  |  F: +61 2 9850 8114<tel:%2B61%202%209850%209695>
M:+61 407 288 255<tel:%2B61%20409%20125%20670>  |  E: ross.moore at mq.edu.au<mailto:rick.minter at mq.edu.au>

http://www.maths.mq.edu.au<http://mq.edu.au/>


[cid:image001.png at 01D030BE.D37A46F0]<http://mq.edu.au/>


CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.<http://mq.edu.au/>

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University.<http://mq.edu.au/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20160711/1293e08c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <http://tug.org/pipermail/xetex/attachments/20160711/1293e08c/attachment-0001.png>


More information about the XeTeX mailing list