<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Insert multi page PDF in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5705260#M140505</link>
    <description>Was hoping to include it as a free extra utility in a package being sold that interacts with a database app. I'm happy to use it as is but wouldn't want to distribute it this way, even as a freebie.</description>
    <pubDate>Fri, 03 Jul 2015 17:48:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-07-03T17:48:50Z</dc:date>
    <item>
      <title>Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5695335#M140498</link>
      <description>&lt;P&gt;I am trying to create a function to automatically insert multi-page pdf documents into AutoCAD.&lt;/P&gt;&lt;P&gt;Should be simple, but I can't get AutoCAD to recognize that it has reached the last page of the pdf document or set a variable to the total number of pages in the pdf document.&amp;nbsp;&amp;nbsp;It works as is but you have to escape out of it's failure to insert the non-existant page after the last page.&amp;nbsp; Would like an elegent automatic way out before distributing this to other users.&lt;/P&gt;&lt;P&gt;Here's what I've got:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:PDF ()&lt;BR /&gt;&amp;nbsp; (setq fname (getfiled "Select PDF to Insert" (getvar 'dwgprefix) "pdf" 0))&lt;BR /&gt;&amp;nbsp; (setq ipoint (getpoint "select insertion point"))&lt;BR /&gt;&amp;nbsp; (setq pagenum 1)&lt;BR /&gt;&amp;nbsp; (setq pagetotal 15) ; is there a system variable that can give me the actual number?&lt;BR /&gt;&amp;nbsp; (while (&amp;lt; pagenum pagetotal)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq catchit (vl-catch-all-apply '(lambda () (command "-pdfattach" fname pagenum ipoint 1 0 ))))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if (vl-catch-all-error-p catchit) (setq pagenum pagetotal) (setq pagenum (+ pagenum 1))) ; apparently no more pages is not an error&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq ipoint (list (car ipoint) (- (cadr ipoint) 8.5)))&lt;BR /&gt;&amp;nbsp; )&amp;nbsp;;while&lt;BR /&gt;)&amp;nbsp;;PDF&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2015 16:27:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5695335#M140498</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-26T16:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5698583#M140499</link>
      <description>&lt;P&gt;To get the number of pages in a PDF file, get the total number of regular expression matches of&amp;nbsp;"/Type\s*/Page[^s]" within the file contents. &amp;nbsp;- Lanny&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2015 22:14:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5698583#M140499</guid>
      <dc:creator>lando7189</dc:creator>
      <dc:date>2015-06-29T22:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5698609#M140500</link>
      <description>&lt;P&gt;Actually... you can find the count in the PDF file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun GetPdfPageCount (FileName / File TextItem TypePages Count)
  (if (setq File (open FileName "r"))
    (progn
      (while (and (not Count) (setq TextItem (read-line File)))
	(if (wcmatch TextItem "/Type /Pages*")
          (setq TypePages T)
          (if (wcmatch TextItem "/Count [0-9]*")
            (setq Count (atoi (substr TextItem 7)))
          )
        )
      )
      (setq File (close File))
    )
  )
  Count
)&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jun 2015 22:42:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5698609#M140500</guid>
      <dc:creator>lando7189</dc:creator>
      <dc:date>2015-06-29T22:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5699137#M140501</link>
      <description>&lt;P&gt;probably something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:DF () Multipage PDF Insert&lt;BR /&gt;&amp;nbsp; (setq fname (getfiled "Select PDF to Insert" (getvar 'dwgprefix) "pdf" 0))&lt;BR /&gt;&amp;nbsp; (setq ipoint (getpoint "select insertion point"))&lt;BR /&gt;&amp;nbsp; (setq pagenum 1)&lt;BR /&gt;&amp;nbsp; (setq pagetotal (getreal "\nType Total Number of Pages you want to Insert: "))&lt;BR /&gt;&amp;nbsp; (while (&amp;lt;= pagenum pagetotal)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq catchit (vl-catch-all-apply '(lambda () (command "-pdfattach" fname pagenum ipoint 1 0 ))))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if (vl-catch-all-error-p catchit) (setq pagenum pagetotal) (setq pagenum (+ pagenum 1))) ; apparently no more pages is not an error&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq ipoint (list (car ipoint) (- (cadr ipoint) 8.5)))&lt;BR /&gt;&amp;nbsp; ) ;while&lt;BR /&gt;) ;PDF&lt;BR /&gt;(c:df)&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 05:59:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5699137#M140501</guid>
      <dc:creator>danglar</dc:creator>
      <dc:date>2015-06-30T05:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5699190#M140502</link>
      <description>&lt;P&gt;I tried to do this function for group of PDF, but it works only for first two ones. Probably somebody knows how to fix it?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;(defun c:pdf (/ lst a b fin)&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; ;; DosLib required&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; (if (setq lst (dos_getfilem "Select PDF's to insert:" (getvar "dwgprefix") "" ))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((lambda (layers)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (foreach file (vl-sort (cdr lst) (function &amp;gt;))&lt;BR /&gt;(setq ipoint (getpoint "select insertion point"))&lt;BR /&gt;(setq pagenum 1)&lt;BR /&gt;&amp;nbsp; (setq pagetotal (getreal "\nType Total Number of Pages you want to Insert: "))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if fin&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (progn&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (vla-GetBoundingBox (car fin) 'a 'b)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq b (vlax-safearray-&amp;gt;list b))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (vl-cmdf "_pdfattach" (strcat (car lst) file) (list 0. (1+ (cadr b))) "")&lt;BR /&gt;&amp;nbsp;&amp;nbsp; )&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(while (&amp;lt;= pagenum pagetotal)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq catchit (vl-catch-all-apply '(lambda () (command "-pdfattach" (strcat (car lst) file) pagenum ipoint 1 0 ))))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if (vl-catch-all-error-p catchit) (setq pagenum pagetotal) (setq pagenum (+ pagenum 1))) ; apparently no more pages is not an error&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (setq ipoint (list (car ipoint) (- (cadr ipoint) 8.5)))&lt;BR /&gt;&amp;nbsp; ) ;while&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (vl-cmdf "_pdfattach" (strcat (car lst) file) ipoint "")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (vla-put-layer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (car (setq fin (cons (vlax-ename-&amp;gt;vla-object (entlast)) fin)))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (vla-get-name (vla-add layers (vl-filename-base file)))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (vla-get-layers&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (cond (*AcadDoc*)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp; (princ)&lt;BR /&gt;)&lt;BR /&gt;(c:pdf)&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 07:08:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5699190#M140502</guid>
      <dc:creator>danglar</dc:creator>
      <dc:date>2015-06-30T07:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5705201#M140503</link>
      <description>&lt;P&gt;Looked promising but my 4 page PDF file has no instances of "/Count" and only one instance of "/Pages".&amp;nbsp; I thought maybe this:&lt;/P&gt;&lt;P&gt;/PageLayout/SinglePage/PageMode/UseThumbs/Pages 3 0&lt;/P&gt;&lt;P&gt;But&amp;nbsp;it is a 4 page document, not a 3 page document.&lt;/P&gt;&lt;P&gt;Any other ideas how PDF pages could be counted?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jul 2015 15:56:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5705201#M140503</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-03T15:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5705206#M140504</link>
      <description>&lt;P&gt;Mark,&lt;/P&gt;
&lt;P&gt;The situation is more complex than the programs posted accomodate.&amp;nbsp; Programs need to look for /N sequences&amp;nbsp; /count sequences among others.&amp;nbsp; Are you trying to sell the resulting program? Reducing the need for someone hit the escape key to stop the program is hardly worth all this effort for a free solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Doug&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jul 2015 16:04:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5705206#M140504</guid>
      <dc:creator>dbroad</dc:creator>
      <dc:date>2015-07-03T16:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5705260#M140505</link>
      <description>Was hoping to include it as a free extra utility in a package being sold that interacts with a database app. I'm happy to use it as is but wouldn't want to distribute it this way, even as a freebie.</description>
      <pubDate>Fri, 03 Jul 2015 17:48:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5705260#M140505</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-03T17:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5705261#M140506</link>
      <description>Thought it might be easy since pdfattach is already evaluating this kind of info.</description>
      <pubDate>Fri, 03 Jul 2015 17:50:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5705261#M140506</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-03T17:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5705382#M140507</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to create a function to automatically insert multi-page pdf documents into AutoCAD.&lt;/P&gt;
&lt;P&gt;Should be simple, but I can't get AutoCAD to recognize that it has reached the last page of the pdf document or set a variable to the total number of pages in the pdf document.&amp;nbsp;&amp;nbsp;It works as is but you have to escape out of it's failure to insert the non-existant page after the last page.&amp;nbsp; Would like an elegent automatic way out before distributing this to other users.&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi Mark,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for an elegent automatic way, you'll have to be a member, but this &lt;A href="http://www.theswamp.org/index.php?topic=39001.msg441632#msg441632" target="_blank"&gt;Lee Mac's '_PDFPageCount' &lt;/A&gt;using 'Scripting.FileSystemObject' and 'VBScript.RegExp' &lt;SPAN class="hps"&gt;calculates&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the correct&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;number of&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;pages.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;Not so &lt;EM&gt;'elegent automatic way'&lt;/EM&gt;, &lt;SPAN class="hps alt-edited"&gt;perhaps&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;something like this&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;will do the trick&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:PDF (/ fname ipoint pagenum)
  (if (and (setq fname (getfiled "Select PDF to Insert" (getvar 'dwgprefix) "pdf" 0))
           (setq ipoint (getpoint "select insertion point"))
           (setq pagenum 0)
      )
    (while (progn (vl-cmdf "-pdfattach" fname (setq pagenum (1+ pagenum)))
                  (if (wcmatch (getvar 'LASTPROMPT) (strcat "*" fname "*"))
                    (command)
                    (vl-cmdf ipoint 1 0)
                  )
           )
      (setq ipoint (list (car ipoint) (- (cadr ipoint) 8.5)))
    ); while
  ); if
  (princ)
); PDF&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="hps"&gt;&lt;SPAN class="hps"&gt;Hope this helps, &lt;BR /&gt;Henrique&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jul 2015 22:54:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/5705382#M140507</guid>
      <dc:creator>hmsilva</dc:creator>
      <dc:date>2015-07-03T22:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/11903810#M140508</link>
      <description>&lt;P&gt;Hai.. i am using the previous provided reply, and with some alteration, here are the code. but i do not know whether it can be use with autocad or not, because i am using other application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:MP (/ fname ipoint pagenum)
   (setq fname (getfiled "Select PDF to Insert" (getvar 'dwgprefix) "pdf" 0))
   (setq ipoint '(0 0))
   (setq pagenum 1)
   (setq pagelast (getreal "\nType Total Number of Pages you want to Insert: "))

   (while (&amp;lt;= pagenum pagelast)
          (command "_pdfimport" "f" fname pagenum ipoint "" "")
          (prompt "\nLook like we have another page.")
          (setq ipoint (list (car ipoint) (+ (cadr ipoint) 150)))
          (setq pagenum (+ 1 pagenum))
          (if (&amp;gt; pagenum pagelast)
              (and (prompt "\nAll pages have been imported.")
                   (exit)
                   );and;
              );if;
          );while;
   (princ)
);MP;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For on my use, it can function, but the object inserted is blocked on the same block. I wonder if it can be inserted on different block and name. Just naming according to page name is enough.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there is another discussion on this but i am not yet go thru it. here are the link:&lt;BR /&gt;&lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-pdf-pages-help/td-p/9890051" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-pdf-pages-help/td-p/9890051&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 09:17:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/11903810#M140508</guid>
      <dc:creator>aliff_ahtenk</dc:creator>
      <dc:date>2023-04-18T09:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/12657409#M140509</link>
      <description>&lt;P&gt;3/21/2024 Revisited - Need to insert each page manually into a checkerboard style model space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AutoCAD R2024-LT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lando's method is not through enough.&lt;/P&gt;&lt;P&gt;Opening 3 random PDF's here showed two of them had "Count" and the third had meta data to a file outside the realm of the pdf file itself:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt;/ITXT(4.1.6)/Kids[1 0 R 676 0 R 961 0 R]/Count 3/Type/Pages&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;] /Count 10&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt;/Length 3348/Subtype/XML/Type/Metadata&amp;gt;&amp;gt;stream&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lee Mac's shows promise but the following 2 lines are not available for R2024-LT&lt;/P&gt;&lt;P&gt;(vlax-create-object "Scripting.FileSystemObject")&lt;BR /&gt;(vlax-create-object "VBScript.RegExp")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hmsilva works, but I need to manually place each PDF page on a checkerboard style model space.&lt;/P&gt;&lt;P&gt;The first checkerboard row may require 2 or 3 boxes to be fill out.&lt;/P&gt;&lt;P&gt;The second row 2, 3, 4, or 5 boxes to fill out, etc.&lt;/P&gt;&lt;P&gt;The following is what I have come up with to bring in the PDF pages and manually place them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:I-PDF ( / fn n )
 (princ "Insert PDF (PDFATTACH) ")
 (if (and (setq fn (getfiled "Select PDF file to Insert" (getvar "DWGPREFIX") "pdf" 0) n 0)
          (findfile fn))
  (while fn
   (setvar "CMDECHO" 0)
   (command "-PDFATTACH" fn (setq n (1+ n)))
   (if (wcmatch (getvar "LASTPROMPT") (strcat "*" fn "*"))
    (progn
     (setvar "CMDECHO" 1)
     (setq fn (command))
    );progn
    (progn
     (command (getvar "VIEWCTR") 1 0.0)
     (setvar "CMDECHO" 1)(princ "\n")
     (command "MOVE" "Last" "" (getvar "VIEWCTR") pause)
    );progn
   );if
  );while
  (princ "\n PDF file not found. ")
 );if
 (setq fn nil n nil)(princ)
);end I-PDF&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks goes out to Hmsilva for providing the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From here I plan to create a dialog box which gives the option to insert all pages or provide an edit box to enter specific pages - in a preferred order (I desire this method as well). Insert odd pages first, then even pages is also on the plate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 21:44:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/12657409#M140509</guid>
      <dc:creator>scot-65</dc:creator>
      <dc:date>2024-03-21T21:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/12657953#M140510</link>
      <description>&lt;P&gt;I answered with a possible solution some time ago that opened a PDF and made images of every page, then inserted all those images in a dwg so you could pick a page to insert, rather than guess the page number, the solution was the use of Ghostcript to create the images. It imported the images in a checker pattern based on number of pages 1 column 2 3 etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I remember now had problems running the ghostcript command from lisp worked properly when ran as a Bat file from windows, the poster decided to give up so I did to. Will try to find.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am pretty sure Lee-Mac has posted some stuff about reading pdf properties.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 04:45:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/12657953#M140510</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-03-22T04:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/13075363#M140511</link>
      <description>&lt;P&gt;Thanks for your lisp, &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/43171"&gt;@scot-65&lt;/a&gt;&lt;BR /&gt;Is there any quick command or lisp to be used to replace the inserted PDFs with a new PDFs but different filename?&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 01:10:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/13075363#M140511</guid>
      <dc:creator>htran4</dc:creator>
      <dc:date>2024-10-10T01:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/13075502#M140512</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15244206"&gt;@htran4&lt;/a&gt;&amp;nbsp;wrote:&lt;P&gt;Is there any quick command or lisp to be used to replace the inserted PDFs with a new PDFs but different filename?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Search the Internet by name - AutoImportCAD&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 03:38:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/13075502#M140512</guid>
      <dc:creator>baksconstructor</dc:creator>
      <dc:date>2024-10-10T03:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/13075824#M140513</link>
      <description>&lt;P&gt;You don't need to "guess" the number of pages inside the PDF, you can use AutoCAD command to detect the count. See the MPDFIMPORT LISP utility - &lt;A href="https://www.cadforum.cz/en/bulk-import-pages-from-a-multi-page-pdf-into-autocad-tip13622" target="_blank"&gt;https://www.cadforum.cz/en/bulk-import-pages-from-a-multi-page-pdf-into-autocad-tip13622&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Vladimir Michl, &lt;A href="http://www.arkance.world" target="_blank"&gt;www.arkance.world&lt;/A&gt;&amp;nbsp; -&amp;nbsp; &lt;A href="http://www.cadforum.cz" target="_blank"&gt;www.cadforum.cz&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 07:53:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/13075824#M140513</guid>
      <dc:creator>vladimir_michl</dc:creator>
      <dc:date>2024-10-10T07:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Insert multi page PDF</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/13415169#M140514</link>
      <description>&lt;P&gt;just what i was looking for.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Merlin Kauffman&lt;/P&gt;</description>
      <pubDate>Tue, 08 Apr 2025 17:10:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-multi-page-pdf/m-p/13415169#M140514</guid>
      <dc:creator>9961_E24BVNJL8HBU</dc:creator>
      <dc:date>2025-04-08T17:10:56Z</dc:date>
    </item>
  </channel>
</rss>

