Importing multiple PDF pages into AutoCAD

Cover Photo.png

Simplifying Multi-Page PDF Imports with AutoLISP

 

PDFIMPORT is one of the many powerful features in AutoCAD that allows you to convert PDF drawings into AutoCAD drawing files. This command is particularly useful when converting old drawings into CAD, modifying sample drawings received from a customer, or for various other purposes.

 

AutoCAD does a great job of handling and bringing in all the geometry data based on user-specified settings. While the PDFIMPORT command focuses on importing one page at a time, there are efficient techniques to work with multi-page PDFs, which are discussed in this article: Import Multi-Page PDF in AutoCAD Products Import multi-page PDF in AutoCAD products.

 

For users working with PDFs containing many pages, importing them individually can feel repetitive. After noticing this topic frequently discussed in forums and receiving similar inquiries from my colleagues, I decided to create a simple AutoLISP program to extend the functionality of the PDFIMPORT command.

 

If you know the size of the pages you want to import, my program, MPDFIMPORT, automates the process by looping the PDFIMPORT command with proper offsets. This approach allows you to efficiently bring in all the pages from your PDF. This article will walk you through how the program works and how it can simplify multi-page PDF imports

 

 

Note: This is not an official Autodesk tool. It is a custom program I created to enhance the usability of the PDFIMPORT command by providing a more streamlined and user-friendly interface.

 

 

Getting program ready

 

If you’re new to AutoLISP, I recommend starting with the article AutoLISP and Visual LISP (AutoLISP) and one of my earlier blog posts, How to Add Custom AutoLISP Commands into AutoCAD’s Ribbon. These resources will help you get familiar with AutoLISP basics and customization.

 

You can download the AutoLISP program MultiplePDFImport.lsp and its accompanying dialog box file MultiplePDFImport.dcl from the attachments of this blog. Save both files in a local folder on your computer, such as C:\Users\YourUsername\Documents\AutoLISP\, or any other location where you keep AutoCAD files.

 

Next, add this folder to AutoCAD’s Support File Search Paths. This step ensures AutoCAD can locate and load the files when the program runs, avoiding errors related to missing resources.

 

How to Add a New Path to AutoCAD’s Support File Search Paths:

  1. Open AutoCAD and type OPTIONS in the command line. Press Enter.
  2. In the Options dialog box, go to the Files tab.
  3. Expand the Support File Search Path category by clicking the plus (+) sign.
  4. Click Add... and then click the new empty line.
  5. Click Browse... and navigate to your AutoLISP and DCL files folder.
  6. Select the folder and click OK to confirm.
  7. Click Apply and OK to save your changes and close the dialog box.

 

The next step is to load the AutoLISP program into AutoCAD. There are several ways to do this, but one of the most commonly used methods is the APPLOAD command. This allows you to manually select and load the program, which is explained in detail in the Tutorial: Creating, Loading, and Opening an AutoLISP File (AutoLISP)

 

For those looking to automate the process, one of my earlier blog posts, How to Add Custom AutoLISP Commands into AutoCAD’s Ribbon, provides a step-by-step guide on how to automatically load AutoLISP programs and integrate them directly into the AutoCAD ribbon for easier access.

 

 

MPDFIMPORT command

 

Once the AutoLISP program is successfully loaded, the MPDFIMPORT command becomes available in the command line. To begin, run the MPDFIMPORT command, and you will be prompted to select a PDF file to import.

 

Reference Image 1 - Select a PDF File.png

 

After selecting a valid PDF file, the Multi PDF Import dialog box will appear. This dialog provides two options for handling the imported PDF pages:

 

Option A: Insert all PDF pages into the currently open drawing.

This option sequentially imports each page of the PDF and places them in the active drawing based on the offset values provided by the user.

 

Option B: Create a new drawing for each page of the PDF.

With this option, each page of the PDF is imported individually and saved as a separate .dwg file.

 

Choose the option best suits your workflow and let the command automate the PDF importing process.

 

 

 

Dialog Box Settings

 

The Multi PDF Import dialog box provides several settings that are available for both Option A and Option B:

Start Page: Specify the first page of the PDF you want to import. This value must be a positive integer greater than zero.

End Page: Specify the last page of the PDF to be imported. Like the start page, this must be a positive integer greater than zero.

Specify Insertion Point on Screen: Check this box to manually specify a custom insertion point for the imported PDF pages. If unchecked, the first page will be imported at the default coordinates (0,0,0).

Scale: Define the scale factor for the imported PDF pages. This value must be a positive number greater than zero.

Angle: Set the rotation angle for the imported pages. This can be any valid numerical value.

 

Reference Image 2 - MPDF dialog.png

 

 

 

Option A Specific Settings

 

The Multiple PDF Import Dialog looks like the image below when using Option A. The settings under "Place on Existing Drawing" on the right side allow you to customize how the pages are placed in the current drawing:

Paper Size: The dropdown contains commonly used paper sizes in AutoCAD. Selecting a size from the dropdown automatically updates the Page Height and Page Width fields.

Metric/Imperial Toggle: Switch between metric and imperial units. This toggle updates the available paper sizes in the Paper Size dropdown accordingly.

Page Height: This field can be manually edited or updated automatically when selecting a paper size. The height value calculates the minimum vertical offset required for placing drawings below existing ones.

Page Width: Similar to the height field, this can be manually entered or populated through the Paper Size dropdown. The width determines the minimum horizontal offset needed to position drawings to the right of existing ones.

Max Drawings in a Row: Specifies the maximum number of drawings to place in a single row before starting a new row below.

Horizontal Offset: Adds extra spacing between drawings placed side by side.

Vertical Offset: Adds additional spacing between drawings placed on different rows.

 

If you are unsure about paper size, You can always import one page of the PDF using PDFIMPORT command and use the dimension tool to measure paper height and width.

 

Reference Image 3 - Option A.png

 

Sample PDF Import with Option A

 

arshdeepsingh404_0-1739115324804.png

 

 

Option B Specific Settings

 

The Multiple PDF Import Dialog looks like the image below when using Option B. The settings under "Create new drawings" on the bottom side allow you to specify the following:

 

File Path: Define the folder where the newly created drawings will be saved. Ensure this folder is accessible and has write permissions to avoid issues during the process.

 

Unlike Option A, paper size or offset adjustments are unnecessary for Option B since only one page from the PDF is imported into each new drawing. The new drawings follow the following naming convention: PDFFilename–PDFPageNumber

 

For example, if the file is named Site Plan.pdf, the drawings will be saved as:

  • Site Plan-Page 1.dwg
  • Site Plan-Page 2.dwg

 

Reference Image 4 - Option B.png

 

 

When using Option B to import PDF pages, a warning message is displayed to notify users that the command will erase any existing contents in the currently open drawing. After clearing the drawing, the selected PDF page is imported, and the command performs a Save As operation to create a new DWG file.

 

The program overwrites any dwg files with duplicate names in the specified folder by default. However, if a duplicate file is already open in AutoCAD, the Save As operation will fail, as AutoCAD cannot overwrite files currently in use.

To avoid potential issues, please ensure that the destination folder is empty or that no drawings are open from the destination folder.

 

Reference Image 5 - Option B Warning.png

 

Sample PDF Import with Option B

 

arshdeepsingh404_1-1739115478958.png

 

 

Version History and Future Updates

 

The current version provides essential functionality for importing multi-page PDFs into AutoCAD. Based on user feedback, future updates may bring additional features and improvements.

Please report any bugs or suggestions for new functionality by commenting below or sending me a personal message. Your feedback is invaluable and will help improve this tool for the entire community.

 

Version History:

Initial Release - January 20, 2025

 

 

I hope that MPDFIMPORT proves to be a helpful addition to your AutoCAD workflow. Whether you're working with legacy drawings, customer-provided samples, or any other PDF files, this tool is designed to save time and effort.

 

Thank you for trying out the program, and I look forward to hearing how it has helped you streamline your work!

11 Comments
paullimapa
Mentor

Looks like a great addition to AutoCAD. Any reason for not incorporating the dcl inside the lisp function so that it’s written at the time of execution and then deleted?

arshdeepsingh404
Advocate

Thanks @paullimapa 

 

That's a great point! I considered incorporating the DCL directly within the LISP function by writing it at runtime and deleting it afterward. However, I wasn't sure if users would prefer handling temporary files that way. Most examples I found kept the DCL separate, likely to maintain a clear distinction between the two languages.

 

I’d love to hear your thoughts, do you think embedding the DCL in LISP would improve usability, or do you prefer the traditional approach of keeping them separate?

 

paullimapa
Mentor

I've actually always preferred to incorporate the dcl as part of the lisp function. This way users don't have to keep track of both. The lisp can write to the temp folder, load it and then delete it when done. This also prevents users from accidentally modifying or deleting the dcl.

paullimapa
Mentor

I have Bug Report & Wish List Items.

Bug Report:

paullimapa_0-1740434300062.png

Wishlist Items:

1. Instead of using the limited getfiled code to request for pdf file selection:

 

(setq File (getfiled "Select PDF file to import" "" "pdf" 8))

paullimapa_2-1740434504822.png

 

Provide an option if Express Tools is loaded to use this code which provides a more flexible window:

 

(setq File (acet-ui-getfile "Select PDF file to import" "" "pdf" "" 8))

paullimapa_4-1740435115392.png

 

2. Provide Option to Toggle & swap Page Height with Page Width sizes:

paullimapa_5-1740435525209.png

 

 

 

 

 

 

arshdeepsingh404
Advocate

Thanks for taking you time to test the program and for such a detailed feedback Paul. I will definitely sort out the bug you reported and the Wishlist items seems like a great addition as well. Thanks for your suggestion to incorporate the dcl into lisp as well, This will make it easier for users as they won't have to track both items.

 

I also received some good feedback from the forums, seems like the tool works well for both AutoCAD and AutoCAD LT platforms.

cgreiner788FU
Observer

This works great & was super helpful. There is one thing however I'd like to ask about. 

 

When converting pdf's, is there a way for this to also capture raster images within the pdf files?

As of now nothing will show up on the dwg file where the raster image would have been.

paullimapa
Mentor

Perhaps it’s as simple as adjusting the PdfImport settings by checking the raster images box

https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-C61D24C2-411D-44A6-B93E-E4A07E47060E

arshdeepsingh404
Advocate

Hello CJ, I am glad you found it helpful.


Great suggestion by Paul here, I would suggest the same to run the PDFIMPORT command on it's own first and test the settings that allow you to bring in the raster images, before running the custom MPDFIMPORT program.

Sometimes it's just the quality of raster images in the PDF that doesn't allow you to import them with PDFIMPORT command.

If you unable to import images after changing settings, Let me know. There are some tips and tricks like running a script to import images like company logo on multiple drawings.

cgreiner788FU
Observer

@arshdeepsingh404 @paullimapa It was as simple as ticking the raster image box in the PDFIMPORT command settings. Thank you for the help!

paullimapa
Mentor

you are welcome...also you can do this at the command prompt before executing the lisp or even the PDFIMPORT command by setting PDFIMPORTFILTER to 0. Then all data types including raster images will be imported as per AutoCAD help:

paullimapa_0-1741114751073.png

 

 

cadblocks_click
New Member

Excellent contribution! Thank you for taking the time to create such a long and detailed tutorial!