<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi Phil,
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Jul 11, 2016, at 3:40 AM, Philip Taylor <<a href="mailto:P.Taylor@Rhul.Ac.Uk" class="">P.Taylor@Rhul.Ac.Uk</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div bgcolor="#FFFFFF" text="#000000" class="">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.
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>I note the /almost/. :-)</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div bgcolor="#FFFFFF" text="#000000" class="">Full compliance can be achieved using Adobe Acrobat.
<br class="">
</div>
</div>
</blockquote>
<div><br class="">
</div>
Of course. Using the “Preflight” utility in modern Acrobat Pro, you can do just about</div>
<div>anything with PDFs, for standards compliance and compatibility.<br class="">
<div><br class="">
</div>
<div>The big problem is to do it entirely within TeX-related software, </div>
<div>*without* using Acrobat Pro, except for checking that you’ve done it right.</div>
<div><br class="">
</div>
<div>In reality, creating PDF/X-compliant documents is significantly more involved</div>
<div>than what you have achieved so far.</div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div bgcolor="#FFFFFF" text="#000000" class="">
<blockquote cite="mid:57827B7B.1010408@Rhul.Ac.Uk" type="cite" class=""><tt class="">\newif \ifpdfxa<br class="">
\pdfxatrue<br class="">
<br class="">
\ifpdfxa<br class="">
\special {pdf: put @thispage << /ArtBox [0 0 498.89641 708.65968] >>}<br class="">
\special {pdf: put @thispage << /BleedBox [0 0 498.89641 708.65968] >>}<br class="">
\special {pdf: put @thispage << /CropBox [0 0 498.89641 708.65968] >>}<br class="">
\special {pdf: put @thispage << /MediaBox [0 0 498.89641 708.65968] >>}<br class="">
\special {pdf: put @thispage << /TrimBox [0 0 498.89641 708.65968] >>}<br class="">
\special {pdf: docinfo << /GTS_PDFXVersion (PDF/X-1:2001) /GTS_PDFXConformance (PDF/X-1a:2001) >>}<br class="">
\special {pdf: put @catalog << /PageMode /UseNone /OutputIntents [ << /Info (none) /Type /OutputIntent /S /GTS_PDFX /OutputConditionIdentifier (Custom) /RegistryName (<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.color.org/"></a><a class="moz-txt-link-freetext" href="http://www.color.org/">http://www.color.org/</a>)
>> ] >>}<br class="">
\special {pdf: dest (page.1) [@thispage /XYZ @xpos @ypos null]}<br class="">
\special {pdf: docinfo << /Title(Document Title)/Subject(Some subject)/Creator(XeTeX)/ModDate(D:yyyymmddhhmmss)/Author(Your Name)/Producer(XeTeX version)/Keywords(Whatever)/Trapped/False >>}<br class="">
\fi</tt><br class="">
</blockquote>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>Using this there are several deficiencies.</div>
<div><br class="">
</div>
<div>1. You should drop the /ArtBox completely.</div>
<div> PDF/X allows /ArtBox or /TrimBox but *not both* (even if they are set to be the same).</div>
<div> Some applications require the /TrimBox, so this figures to be the best choice.</div>
<div><br class="">
</div>
<div>2. PDF/X-1a doesn’t like compressed object streams.</div>
<div> There is a command-line switch: xdvipdfmx -z 0 .</div>
<div> But it results in a much larger file size in a real-world document.</div>
<div> Besides, with a document based on your example, and using this switch,</div>
<div> I cannot get Acrobat to stop complaining about compressed object streams,</div>
<div> even though the page stream is clearly not compressed:</div>
<div> </div>
<div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">5 0 obj</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><</Length 117>></div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">stream</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> 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</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;" class="">
<br class="">
</div>
<div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">endstream</div>
<div class=""><br class="">
</div>
<div class="">Fonts in that PDF do use compression.</div>
<div class="">The only other thing compressed is the XRef table.</div>
<div class="">When Acrobat is asked to convert to PDF/X the xref table is uncompressed;</div>
<div class="">so that figures to be the real issue here. </div>
<div class=""><br class="">
</div>
<div class="">Pity there is no free online PDF/X validator, like there are for PDF/A, to see what it might say.</div>
<div class="">In any case, we need to be able to stop xdvipdfmx from producing a compressed XRef table.</div>
<div class=""><br class="">
</div>
</div>
<div><br class="">
</div>
<div>3. Your OutputIntent with /Info(None) and /OutputConditionIdentifier (Custom) </div>
<div> is of no use to anybody or anything. I’m surprised Acrobat doesn’t flag this.</div>
<div><br class="">
</div>
<div> You need to include a real ICC color profile (usually CMYK for PDF/X) which is</div>
<div> typically at least .5 MByte in size, often much larger.</div>
<div><br class="">
</div>
<div> Upon checking for PDF/X-4 and higher levels, this *is* flagged as an issue.</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div>4. The \special {pdf: docinfo << … } while valid, is *not* the recommended way to</div>
<div> provide Metadata. </div>
<div> The modern way is via XMP which is an XML stream using uncompressed UTF-8 encoding.</div>
<div> Some docinfo fields can be included also, provided they agree *exactly* with what</div>
<div> is in the XMP packet. For things like multiple authors, and more than one Keyword entry,</div>
<div> it is best to put them into the XMP *only*.</div>
<div><br class="">
</div>
<div> Again, with PDF/X-4 and higher, this is flagged as an issue.</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div>All of these issues are addressed, also for XeLaTeX, in the latest version (1.5.8) </div>
<div>of the pdfx LaTeX package.</div>
<div> <a href="https://www.ctan.org/pkg/pdfx?lang=en" class="">https://www.ctan.org/pkg/pdfx?lang=en</a></div>
<div><br class="">
</div>
<div>The package itself implements everything, (including ensuring that the correct color spaces are used) </div>
<div>and the documentation explains how to specify the (external) Metadata that you may wish to provide.</div>
<div>It has a sub-section discussing the limitations when using XeTeX as engine.</div>
<div><br class="">
</div>
<div>Although a LaTeX package, you can check the source coding to find out how issues</div>
<div>are addressed. Look in particular for \ifxetex sections.</div>
<div>Most of the coding is straightforward TeX macro programming.</div>
<div>Though it does use LaTeX’s \IfFileExists construction, to check that appropriate resources</div>
<div>are available.</div>
<div>(And it loads hyperref to get access to some of its features, but also to cancel some</div>
<div> other features that might conflict with how pdfx is handling the Metadata.) </div>
<div><br class="">
</div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div bgcolor="#FFFFFF" text="#000000" class="">
<blockquote cite="mid:57827B7B.1010408@Rhul.Ac.Uk" type="cite" class=""></blockquote>
The caveats are as follows :<br class="">
<ol class="">
<li class="">a hook will need to be inserted into <tt class="">\shipout</tt> to insert the bounding boxes on each page;</li></ol>
</div>
</div>
</blockquote>
<div> pdfx.sty uses \RequirePackage{everyshi} and \EveryShipout for this.</div>
<div> It’s perhaps a bit of overkill, but a standard way to patch \shipout .</div>
<blockquote type="cite" class="">
<div class="">
<div bgcolor="#FFFFFF" text="#000000" class="">
<ol class="" start="2">
<li class="">the colours will need to be converted to the desired output profile using Adobe Acrobat;</li></ol>
</div>
</div>
</blockquote>
<div>pdfx.sty uses the xcolor package to handle this.</div>
<div> Once a Color Profile is declared (either CMYK or RGB) the appropriate options</div>
<div> are prepared for xcolor then the package is loaded with these options.</div>
<div> Internal macros are rigged to stop changes being made, if the author tries to</div>
<div> load the package separately. Similarly if color was loaded before pdfx ,</div>
<div> then appropriate coding imposes the correct color space.</div>
<div><br class="">
</div>
<div> The upshot of this is that whenever a color is requested by name (‘blue’, ‘red’,</div>
<div> ‘green’, ‘magenta’, etc.) then the correct color space coordinates are used.</div>
<div> Also, if a new color is declared (say as RGB) but the color model is CMYK,</div>
<div> then a conversion is done on the declaration, giving CMYK coords when that</div>
<div> new color is used.</div>
<div><br class="">
</div>
<blockquote type="cite" class="">
<div class="">
<div bgcolor="#FFFFFF" text="#000000" class="">
<ol class="" start="3">
<li class="">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;</li></ol>
</div>
</div>
</blockquote>
<div> Not sure of the specifics of this.</div>
<div> Can anyone provide example documents?</div>
<div> If this is really an issue, does xdvipdfmx have command-line options </div>
<div> which allow specifying what can be compressed and what not?</div>
<div> I don’t think so. </div>
<div><br class="">
</div>
<div> Such control is needed also to have uncompressed XMP Metadata</div>
<div> but compressed content streams, in all flavors/levels of PDF/A.</div>
<div> This is something that is highly desirable. </div>
<div> </div>
<div> pdftex and luatex already do this right, as also will Ghostscript when v9.20 emerges</div>
<div> from pre-release status.</div>
<div> The next version (1.5.9) of pdfx.sty will fully support latex+dvips+GS using this.</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div bgcolor="#FFFFFF" text="#000000" class="">
<ol class="" start="4">
<li class="">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;</li></ol>
</div>
</div>
</blockquote>
<div> Setting these as a constant for all pages figures to be OK for most documents.</div>
<div> Even better might be to reset to the size of each box being shipped-out.</div>
<div> </div>
<div> Since this can actually be done bypassing the \output routine, then it</div>
<div> requires patching \shipout rather than \makeheader or similar.</div>
<div> This is certainly an issue for further discussion.</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div bgcolor="#FFFFFF" text="#000000" class="">
<ol class="" start="5">
<li class=""><tt class="">\setboundingboxes</tt> will have to be called explicitly for the first page only.<br class="">
</li></ol>
<tt class="">\shipout</tt> can be hooked as follows :<br class="">
<tt class=""><br class="">
\def \setboundingboxes<br class="">
{%<br class="">
\special {pdf: put @thispage << /ArtBox [0 0 498.89641 708.65968] >>}%<br class="">
\special {pdf: put @thispage << /BleedBox [0 0 498.89641 708.65968] >>}%<br class="">
\special {pdf: put @thispage << /CropBox [0 0 498.89641 708.65968] >>}%<br class="">
\special {pdf: put @thispage << /MediaBox [0 0 498.89641 708.65968] >>}%<br class="">
\special {pdf: put @thispage << /TrimBox [0 0 498.89641 708.65968] >>}%<br class="">
}<br class="">
</tt></div>
</div>
</blockquote>
<div><br class="">
</div>
<div>Yes, (w/o /ArtBox ); but if you are hooking into \shipout ,</div>
<div>why not measure the size of the box being shipped?</div>
<div>Do the conversion into actual points.</div>
<div>Will the bottom-left corner always be at [0 0] ?</div>
<div>Probably need to look also at \hoffset and \voffset .</div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div bgcolor="#FFFFFF" text="#000000" class=""><tt class=""> <br class="">
\newcount \maxpage<br class="">
\maxpage = <whatever><br class="">
\let \Shipout = \shipout<br class="">
\def \shipout {\ifnum \pageno < \maxpage \setboundingboxes \fi \Shipout}</tt><br class="">
<div class="moz-signature">-- <br class="">
<span id="cid:part2.03050200.06010508@Rhul.Ac.Uk"><Signature.jpg></span><br class="">
Philip Taylor</div>
</div>
</div>
</blockquote>
<br class="">
</div>
<div><br class="">
</div>
<div>Hope this helps,</div>
<div><br class="">
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>Ross</div>
<div><br class="">
</div>
<div apple-content-edited="true" class="">
<div style="font-family: Arial, sans-serif; orphans: 2; widows: 2; " class=""><span class="Apple-style-span" style="font-size: 9px;"><b class=""><span style="font-size: 9pt;" class=""><br class="Apple-interchange-newline">
Dr Ross Moore</span></b></span></div>
<div style="font-family: Arial, sans-serif; orphans: 2; widows: 2;" class="">
<p style="font-family: Arial, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(119, 119, 119); font-size: 7pt; margin-bottom: 3.75pt;" class="">
<font color="#000000" class=""><span style="font-size: 9pt;" class=""><b class="">Mathematics Dept </b><b class="">|</b> Level 2, S2.638 AHH<br class="">
Macquarie University, NSW 2109, Australia</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;" class=""></span></font></p>
<p style="font-family: Arial, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(119, 119, 119); font-size: 7pt; line-height: 11.25pt; margin-bottom: 3.75pt;" class="">
<b class=""><span style="font-size: 9pt;" class=""><font color="#000000" class="">T:</font></span></b><span style="font-size: 9pt;" class=""><font color="#000000" class=""> +61 2 9850 <b class="">8955 | F:</b> </font><a href="tel:%2B61%202%209850%209695" value="+61298509695" target="_blank" class=""><font color="#000000" class="">+61
2 9850 8114</font></a><br class="">
<font color="#000000" class=""><b class="">M:</b><a href="tel:%2B61%20409%20125%20670" value="+61409125670" target="_blank" class="">+61 407 288 255</a><b class=""> | </b>E: </font><a href="mailto:rick.minter@mq.edu.au" target="_blank" class=""><font color="#000000" class="">ross.moore@mq.edu.au</font><font color="#1155cc" class=""><span style="color: black;" class=""></span></font></a><font color="#1155cc" class=""><span style="color: black;" class=""></span></font><span style="color: black;" class=""></span><br class="">
</span></p>
<p style="font-family: Arial, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(119, 119, 119); font-size: 7pt; line-height: 11.25pt; margin-bottom: 3.75pt;" class="">
<span style="font-size: 9pt;" class=""><span style="color: black;" class=""><a title="Macquarie University" href="http://mq.edu.au/" target="_blank" class="">http://www.maths.mq.edu.au</a></span></span></p>
<p style="color: rgb(0, 0, 0); font-family: Arial, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<a href="http://mq.edu.au/" target="_blank" class=""><br class="Apple-interchange-newline">
<span><img height="58" width="260" apple-inline="yes" id="9E19049F-CC76-4693-8903-4028D4A35B8A" apple-width="yes" apple-height="yes" src="cid:image001.png@01D030BE.D37A46F0" class=""></span></a></p>
<p style="font-family: Arial, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(119, 119, 119); font-size: 7pt;" class="">
<a href="http://mq.edu.au/" target="_blank" class=""><span style="color: rgb(119, 119, 119); font-size: 7pt;" class=""><br class="Apple-interchange-newline">
CRICOS Provider Number 00002J. Think before you print. <br class="">
Please consider the environment before printing this email.</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt;" class=""></span></a></p>
<p style="font-family: Arial, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(119, 119, 119); font-size: 7pt;" class="">
<a href="http://mq.edu.au/" target="_blank" class=""><span style="color: rgb(119, 119, 119); font-size: 7pt;" class="">This message is intended for the addressee named and may <br class="">
contain confidential information. If you are not the intended <br class="">
recipient, please delete it and notify the sender. Views expressed <br class="">
in this message are those of the individual sender, and are not <br class="">
necessarily the views of Macquarie University.</span></a></p>
</div>
</div>
<br class="">
</div>
</body>
</html>