Dan
Dan

Reputation: 527

Plot PDF and JPG files into single document

The following loop outputs a series of 12 monthly files into a single PDF document.

printFolderPath="./2015/users/testuser/monthlyPrintFiles/"  
list = system('ls ' . printFolderPath)  
i = 1  
do for [file in list] {  
    load "CalendarSetupConfig-mod.txt"  
    load printFolderPath . file  
    i = i + 1  
}

I would like to alternate each PDF file with a JPEG image file in the same canvas size (US letter in this case).

I can plot JPG files to an Aqua terminal for testing (Mac OSX here) but don't seem to be able to get the output to fill an 8.5 x 11 canvas. For example:

set terminal aqua size 11,8.5
fullYear="./2015/users/testuser/images/04-April-2013.JPG"
plot fullYear binary filetype=jpg origin=(0,0) with rgbimage

I'm leaving out a lot of the setup commands here but my PDF output is good.
The JPG files come in a wide range of pixel dimensions. So the question is: how do I ensure the PDF and JPG plotted files have the same "page" size" in the final output document?

Upvotes: 0

Views: 61

Answers (1)

sweber
sweber

Reputation: 2996

As far as I understand, you want to create a PDF and want a JPEG as background image or similar. What you need is:

Reduce the margin between the graph box and the outer edge of the page to 0

set tmargin 0
set bmargin 0
set lmargin 0
set rmargin 0

remove tickmarks (not necessary, as image is plotted in front of them):

unset xtics
unset ytics

remove the box around the graph plot:

set border 0

Now, gnuplot usually extends the axis ranges to the next tic mark, i.e. an image 1280 pixels wide will cause an x-range from -500 to +1500. Unset this feature:

set autoscale xfix
set autoscale yfix

Here is a screenshot of the result (qt terminal, I have no Mac):

enter image description here

If you want to plot something in front of the picture, have a look into multiplot. Also, you need to reset all the settings done so far:

set tmargin
set bmargin
set lmargin
set rmargin

set xtics
set ytics

set border

set autoscale x
set autoscale y

Upvotes: 1

Related Questions