My answer below merely revises the Code given in the question with @kglr's comments to achieve the objective stated in the question. I thought this might be useful for others in this forum, who aim to automatically print out output cells or input cells in either PNG or PDF or any other format of interest. Below, I show the cases for PDF and PNG.
SetDirectory["(*directory address for saving the outputs created*)" ];
cellCounter = 1;
Map[Export[StringJoin["cell-",
ToString[cellCounter++], ".png"],
NotebookRead[#], ImageSize -> Scaled[.85]]&,
Cells[CellStyle -> {"Output"}]];
The above code creates png files of output cells in the notebook with Imagesize->Scaled[.80], which adjusts the size of the output files to fit one output into a single page. One may adjust the ImageSize->Scaled[...] to print out the output in the desired size.
If one wants to print out the outputs in PDF format, however, replace PNG with PDF in the above code.
The code below performs the same task for input cells to create PDF files.
Map[Export[StringJoin["cell-",
ToString[cellCounter++], ".pdf"],
NotebookRead[#],Imagesize->Scaled[0.8]]&,
Cells[CellStyle\[Rule]{"Input"}]];
Watch out!!!
The above Code should be placed at the very end of the notebook to pick up the already generated outputs and/or inputs. One caveat is that the outputs named as cell1, cell2, etc no matter which notebook you are using. Therefore, the outputs created from a notebook will be overwritten on the outputs created from another notebook. I will revise my answer as soon as I find a solution to this caveat.
EDIT
To prevent overwriting output cells, we use recognizable names. Change cell- in the code above with cell-AA-. This can easily prevent overwriting outputs as the outputs will be saved with such names as cell-AA-1, cell-AA-2, etc.
Cells[CellStyle -> {"Output"}]instead ofCells[]? – kglr Sep 08 '20 at 09:42Directory[]help? – kglr Sep 08 '20 at 09:52ImageSize -> FullorImageSize -> AllinExport? – kglr Sep 08 '20 at 10:23ImageSize->Scaled[0.8], which fits well. Thank you. – Tugrul Temel Sep 08 '20 at 10:44