pdf-extract-001

Tests that pdf-extract works.

Test pdf-extract-001.xml is expected to pass.

The pipeline

<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:p="http://www.w3.org/ns/xproc" name="main" version="3.0">
   <p:import href="https://xmlcalabash.com/ext/library/pdf-steps.xpl"/>
   <p:output port="result"/>
   <cx:pdf-info name="longer">
      <p:with-input href="../documents/longer.pdf"/>
   </cx:pdf-info>
   <cx:pdf-extract pages="2">
      <p:with-input href="../documents/longer.pdf"/>
   </cx:pdf-extract>
   <cx:pdf-info name="extracted" page-text="true"/>
   <p:wrap-sequence wrapper="wrapper">
      <p:with-input pipe="@longer @extracted"/>
   </p:wrap-sequence>
</p:declare-step>

Schematron validation

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <s:ns prefix="cx" uri="http://xmlcalabash.com/ns/extensions"/>
   <s:ns prefix="f" uri="http://xmlcalabash.com/ns/acro-form"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="wrapper">Wrong document element&gt;</s:assert>
      </s:rule>
   </s:pattern>
   <s:pattern>
      <s:rule context="/wrapper">
         <s:assert test="count(cx:pdf-info) = 2">Wrong number of PDF outputs</s:assert>
      </s:rule>
   </s:pattern>
   <s:pattern>
      <s:rule context="/wrapper/cx:pdf-info[1]">
         <s:assert test="cx:pages = 2">Wrong number of pages</s:assert>
      </s:rule>
   </s:pattern>
   <s:pattern>
      <s:rule context="/wrapper/cx:pdf-info[2]">
         <s:assert test="cx:pages = 1">Wrong number of pages</s:assert>
         <s:assert test="starts-with(cx:page-details/cx:page/cx:text, 'aliquip ex ea')">Wrong page</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

11 Jun 2026, Norm Tovey-Walsh

Created test.