I was facing the same issue and couldn't find a neat solution for it. I am posting this here with the hope that it will help someone trying to do something similar.
First, a function to write the coordintes of the top-left and bottom-right points of all the windows I wanted to convert to pdfs:
(defun C:GetCoordinates()
(if (setq f(open "d:/filename.txt" "w"))
(progn
(setq i 1)
(while (<= i 50)
(setq p1 (getpoint "Top Left Point"))
(setq p2 (getpoint "Bottom Right Point"))
(setq p1x (car p1))
(setq p1y (cadr p1))
(setq p2x (car p2))
(setq p2y (cadr p2))
(write-line (strcat (itoa i) "," (rtos p1x 2 3) "," (rtos p1y 2 3) "," (rtos p2x 2 3) "," (rtos p2y 2 3) ",") f)
(setq i (+ i 1))
)
)
)
)
Now, we read the coordinates and convert the windows to pdfs:
(defun C:ConvertToPDF()
(if (setq f(open "d:/filename.txt" "r"))
(progn
(setq j 1)
(while ( <= j 50 )
(setq txtLine(read-line f))
(setq len (strlen txtLine))
(setq i 1)
(setq commaCounter 0)
(setq first 1)
(setq second 1)
(while (<= i len)
(if (= (substr txtLine i 1) ",")
(progn
(setq second i)
(setq str (substr txtLine first (- second first)))
(setq first (+ second 1))
(setq commaCounter (+ commaCounter 1))
(cond ((= commaCounter 1) (setq filename str))
((= commaCounter 2) (setq pt1x (atof str)))
((= commaCounter 3) (setq pt1y (atof str)))
((= commaCounter 4) (setq pt2x (atof str)))
((= commaCounter 5) (setq pt2y (atof str)))
)
)
)
(setq i(+ i 1))
)
(setq point1 (list pt1x pt1y 0))
(setq point2 (list pt2x pt2y 0))
(setq filename2 (strcat "d:/TestPDF/" filename ".pdf"))
(command "-plot" "y" "" "Dwg To PDF.pc3" "ANSI expand B (11.00 x 17.00 Inches)" "M"
"" "N" "w" point1 point2 "" "c" "Y" "." "Y" "" filename2 "N" "y")
(setq j (+ j 1))
)
)
)
)