# pdfPrintToJob

Add pages to a print job.
int pdfPrintToJob(PDFHandle jobControlPDF, PDFHandle pdf)
This function adds one or more pages to a print job (which was started by calling the `pdfPrintStartJob` function).

The first argument is the job-control handle – see `pdfPrintStartJob`. The second argument is the PDF file to be added to the print job. If you want to print pages from the job-control handle, call `pdfPrintToJob(jobControPDF, jobControlPDF)`.

The following functions can be called before calling `pdfPrintToJob` to change parameters independently for each section of a print job:

IMPORTANT: These parameters must be set on the job-control handle, not on the handle for the specific PDF file being printed.

C:
PDFHandle jobControlPDF, pdf2, pdf3; /* open the first PDF file, which is also used as the job-control handle */ pdfLoadFile(&jobControlPDF, "c:\\first.pdf"); /* set parameters that apply to the whole job */ pdfPrintSetPrinter(jobControlPDF, L"printer55"); /* start the print job, using the parameters set above */ pdfPrintStartJob(jobControlPDF); /* set parameters that apply to the first PDF file */ pdfPrintSetPages(jobControlPDF, "3-4"); /* add the first PDF file (which is also the job-control handle) to the job */ pdfPrintToJob(jobControlPDF, jobControlPDF); /* WARNING: do not close jobControlPDF yet */ /* load the second PDF file */ pdfLoadFile(&pdf2, "c:\\second.pdf"); /* set parameters that apply to the second PDF file */ pdfPrintSetPages(jobControlPDF, "1-10"); /* add the second PDF file to the job */ pdfPrintToJob(jobControlPDF, pdf2); /* the second PDF file can be closed here */ pdfFree(pdf2); /* third PDF file is similar to the second */ pdfPrintSetPages(jobControlPDF, "2"); pdfLoadFile(&pdf3, "c:\\third.pdf"); pdfPrintToJob(jobControlPDF, pdf3); pdfFree(pdf3); /* finish the print job */ pdfPrintFinishJob(jobControlPDF); /* the job-control handle can now be closed */ pdfFree(jobControlPDF);