Based on https://www.overleaf.com/latex/examples/mailmerged-business-cards/gnnhcjvkvcfd

I'm trying to implement a project that would generate small business cards based on a csv file. I created a code similar to here:

Print business cards in LaTeX

That is, compiling one business card to the first.pdf file, and for the next compilation inserting it into the second page so that you can cut them according to the pattern. But it does not meet my expectations, I want to achive only second side of my file and in addition not only one person's business card but one by one each line from the file. But not necessarily, I care more about small business cards, it can be one person's data.


My code:

%% This example is adapted from the "Business Cards for Programmers/Developers" example at 
% https://www.overleaf.com/latex/templates/business-cards-for-programmers-slash-developers/wrwgsnnmxwyg.

% Instructions are at the end of the file.

% \setstocksize{297mm}{210mm} % UK Stock size
\setstocksize{55mm}{85mm} % UK Stock size



%% The "database" is a comma-separated values (CSV) file.
%% The first line should contain the column headers, without space characters, e.g.
%% Name,JobTitle,Department
%% If a field value contains a comma, then the field value needs to be surrounded with double quotes, e.g. 
%% John Smith,Lecturer,"School of Science, Mathematics and Engineering"
%% Spreadsheet applications can usually export such a .csv file.
%% If field values are expected to contain LaTeX special characters like $, &, then use \DTLloadrawdb{data}.csv instead.





%% These packages only for typesetting the instructions

% \usepackage   [a4,cross,cam,frame] {crop}


% \usepackage{showframe}

% \addtolength\textheight{210mm}
%  \def\myimg{\protect\rule{1in}{1in}}% THIS CAN BE USED TO CHECK GAP SPACING




%% For each line in namelist (which was loaded from data.csv), 
%% output the following text (with mailmerged field values)
    %% Map each column header in your .csv file to a command
}{%%%  Start designing your output text! 
  %%%  Mailmerged field values can be inserted using the commands
  %%%  you've just mapped above.

    \tiny\mbox{}\Subtitle \hfill {\color{gray}\Division{} / \Employer}\\ 
            % The MECARD format is used to exchange contact information. More information at:
            % https://www.nttdocomo.co.jp/english/service/developer/make/content/barcode/function/application/addressbook/index.html
\psbarcode{MECARD:N:\Name;URL:\Web;EMAIL:\EmailOne;TEL:\Mobile;NOTE:GPG key fingerprint: \GPG;}{eclevel=L width=1 height=1}{qrcode}
            % \hspace{5mm}\mbox{}\SpecialityOne\\
            \mbox{}\SpecialityThree \vspace{2mm}\\
            %   {\color{gray}web}:   & \Web   & \\
                {\color{gray}email}: & \EmailOne    & \\
            %   {\color{gray}email}: & \EmailTwo    & {\color{gray}\,(priv)}\\
                {\color{gray}mobile}:& \Mobile      & \\
    \texttt{\fontsize{2.84mm}{3.55mm}\selectfont \GPG} % GPG KEY ID
    % \clearpage

%% Comment out this line when typesetting for final output
% \input{instructions}

\eject \pdfpagewidth=210mm \pdfpageheight=297mm

% \centering
 {\imgline} {\seperatorline}
 {\imgline} {\seperatorline}
 {\imgline} {\seperatorline}
 {\imgline} {\seperatorline}
 {\imgline} {\seperatorline}}


Data.csv looks like: Name,Subtitle,Division,Employer,JobTitle,Speciality1,Speciality2,Speciality3,Web,Email1,Email2,Mobile,GPG {Helena Doe},subtitle,Division,Employer,Job Title,Speciality 1,Speciality 2,Speciality 3,https://fqdn/,helena@univ.edu,hxr42@gmail.com,+1 123 456 7890,425B 030A B8D2 0316 CA1B 4709 CA83 5DDA EC31 CA56 data

  • 2
    Can you please add a data.csv file to your question without personal informations ? – Mensch Feb 24 '19 at 9:56
  • 1
    I added at the bottom – bartzmc Feb 24 '19 at 10:23
  • I will be happy also with solution that produce one person's small business cards. – bartzmc Feb 24 '19 at 16:14
  • 1
    Well, you should explain your used code a little bit more, for example why image first? Which did you add and what do you think that it should do? Your code is far from beeing minimal and it is not easy to understand without explanation what you are doing/trying ... – Mensch Feb 24 '19 at 16:53
  • First is a pdf document that is created by this sample project link It's single business card shown on first page. Then I'm using it on this project to put it on second page in a pattern. It's a two step process. I want these small business cards to be generated straight away from the file. – bartzmc Feb 24 '19 at 17:13

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.