2

I wish to use package datatool in the standalone class (or with the standalone package, whichever works). I want datatool to print each row in the csv file on different page and standalone to crop each pdf according to the content on it (possibly, with fix width).

Following is my MWE. The example runs properly in article class, however, it gives error(s) in the standalone class. I guess that standalone does not like the clearpage command. However, as per my knowledge, this is the command (or \newpage) that prints each row on different pages in the output PDF.

\documentclass{article}%with this class things are fine.
%\documentclass[border=10pt]{standalone}%this class gives error.

 \usepackage{datatool}
 \DTLloaddb{sample}{sample.csv}%input csv file
 \usepackage{graphicx}

 \begin{document}
   \DTLforeach{sample}{%
      \Nr=Number,\Quote=Quote}{%
    \clearpage

    (\Nr)\Quote
    \begin{center}
      \includegraphics[height=2cm]{test-graphics}
    \end{center}%
  }%
\end{document}

The csv file entries are like

Number, Quote
 1, Quote 1
 2, {Quote 2 which can have more text than other quotes. Thus, this quote would occupy more space than others would do.}
 3, Quote 3

Thank you in advance!

  • I don't think datatool is the right tool if you do it this way. I would use a script or Lua to read the file and generate each separate standalone document. – Alan Munn Apr 16 at 17:55
  • I am not familiar with either script writing or Lua. Could you please direct me to some source to find a appropriate script or a Lua code? BTW, I could get my work done by using a screened package, see personal.psu.edu/jcc8//screenread. Nonetheless, I shall be glad to find out another way as you are suggesting. Thank you in advance! – Rohit D. Holkar Apr 19 at 14:51
  • It's not clear from your question whether you want a single document (with each page a different size?) or a series of individual documents, one per quote. Since you want to crop to the PDFs to content, I assume the latter. And does the image file change per quote too? – Alan Munn Apr 20 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.