Print on a pdf template

Hello everyone,

Can anyone please guide me on a way to print data on a pdf or an image template, meaning you load a ready pdf or a jpeg file to be considered as a background and you plug in the data from the doctype using pixel coordinates or something of the sort??

Cheers

@Merouane_Amraoui that’s what ‘Print formats’ exactly do

@bahaou the idea here is that the img or the pdf file is the background of the document and you add the data from the doctype using pixel coordinates

@Merouane_Amraoui The only thing I can think of that might work is to upload a image of the blank document. Then in your custom print format create all the fields in markup with ids. Example:

<div id="posting_date">{{ doc.posting_date }}</div>
<div id="customer">{{ doc.customer}}</div>
<div id="po_no">{{ doc.po_no}}</div>
<div id="name">{{ doc.name}}</div>

Then in your CSS

body {
background-image: url("path to image of blank document");
}

#posting_date {
top: 100px;
left: 150px;
}

I’m no CSS expert but you can try an approach like this. Maybe it will work.

1 Like

@dj12djdjs Thank you for you reply, yes this is the idea how to do it with an image background, although CSS code needs more codeline in order to achieve the desired objective,

In the case of using a pdf template with many pages, I still yet to find a way to do it, I have been following this thread but still no success, Generate a PDF file for printing based on a template