Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to set plot PDF font 'capture' option with AutoLISP?

16 REPLIES 16
SOLVED
Reply
Message 1 of 17
JBerns
939 Views, 16 Replies

How to set plot PDF font 'capture' option with AutoLISP?

Community,

 

Does anyone know how to programmatically set the option to "Capture fonts used in the drawing" for PDF files?

 

JBerns_0-1696017776813.png

 

I have a LISP routine that creates a DXF and a PDF from a DWG.

 

;; PLOT TO PDF

;; plot settings
(setq
    strOutDev	 "AutoCAD PDF (Smallest File).pc3"
    strPaperSize "ANSI A (8.50 x 11.00 Inches)"
    strPlotRot	 "Landscape"
    strPlotStyle "Monochrome"
    strFileName	 (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)))
) ;_setq

;; set PDF filename
(setq strFileName (strcat (vl-filename-directory a)	;; then build filename without extension
		     "\\"
		     (vl-filename-base a)
		  )
) ;_setq

;; Perform a detailed plot configuration
(command "_.PLOT" "Y")

;; Detail answers
(command "Model"					;;Enter a layout name
	 strOutDev					;;Enter an output device name
	 strPaperSize					;;Enter paper size
	 "I"						;;Enter paper units
	 strPlotRot					;;Enter drawing orientation
	 "N"						;;Plot upside down
	 "D"						;;Enter plot area, Display
	 "F"						;;Enter plot scale or[Fit]
	 "C"						;;Enter plot offset or [Center]
	 "Y"						;;Plot with plot styles
	 strPlotStyle					;;Plot style
	 "N"						;;Plot lineweights
	 "A"						;;Enter shade plot setting
	 (strcat strFileName ".PDF")			;;Write plot to file
	 "N"						;;Save change to page setup
	 "Y"						;;Proceed
) ;_command

 

When plotted with the LISP routine, certain fonts do not display well in Adobe products. In our, case it is Calibri and certain symbols such as the diameter symbol.

 

JBerns_1-1696018032184.png

 

This apparently is a known issue:

https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Font-error-display... 

https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/When-plotting-to-P... 

 

When plotted with the PLOT dialog box, the fonts are included and appear correct when viewed in Adobe products.

When plotted with AutoLISP, the "capture" option seems to be ignored.

 

I hope to find a way to set the "capture" option when plotting with AutoLISP. Perhaps Visual LISP can access these settings.

 

Thank you for your time and attention. I look forward to your replies.

 


Regards,
Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Labels (1)
16 REPLIES 16
Message 2 of 17
paullimapa
in reply to: JBerns

Your screen capture shows plot device as Dwg To Pdf.pc3

But your lisp code shows 

strOutDev	 "AutoCAD PDF (Smallest File).pc3"

Have you tried changing your code to use the same?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 17
JBerns
in reply to: paullimapa

@paullimapa,

 

Thanks for the quick reply.

I had been trying the different PDF output devices that I may have pasted the wrong code.

Can the capture option be set with code during plotting?

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 4 of 17
JBerns
in reply to: JBerns

Also, I performed a detailed plot operation from the command prompt using 'DWG to PDF'. No prompt appeared asking about capturing fonts.

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 5 of 17
paullimapa
in reply to: JBerns

I’m not aware of an option to set that with code which is why it needs to be done first and then the matching pc3 used to plot 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 6 of 17
JBerns
in reply to: paullimapa

So when switching to a different printer, the user will have to manually set the option before they can plot with the LISP routine? 

I am very curious how AutoCAD change the option through the interface, but not with code.

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 7 of 17
paullimapa
in reply to: JBerns

Yep all custom printer settings like page size, lines merge or overwrite and in your case fonts need to be already set in the pc3


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 8 of 17
JBerns
in reply to: paullimapa

Thanks, Paul.

I will try some tests next week.

Have a great weekend. 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 9 of 17
ВeekeeCZ
in reply to: JBerns

It's stored in Registry

 

HKEY_CURRENT_USER\SOFTWARE\Autodesk\AutoCAD\R23.1\ACAD-3000:409\Profiles\YourProfileName\Dialogs\AcQuickPublishOpts\CaptureFontsInDrawing

Message 10 of 17
paullimapa
in reply to: ВeekeeCZ

That registry entry is referring to the PUBLISH Options

paullimapa_0-1696094269222.png

But the OP is referring to the various printer/plotter *.pc3 device options located in the PLOT PDF Options window which are not related when running plot sequence using lisp:

paullimapa_1-1696094389465.png

 

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 11 of 17
ВeekeeCZ
in reply to: paullimapa

@paullimapa 

 

You're right that it does not apply to the plot devices. Unfortunatelly.

 

Just to be accurate, there are actually two keys of the same name. Your screenshots referred to the other one. It's AcPublishDlg.

 

 

My AcQuickPublishOpts refers to this tool.

 

eekeeCZ_0-1696096461185.png

 

 

 

 

Message 12 of 17
paullimapa
in reply to: ВeekeeCZ

Got it. Thanks for the clarification.  


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 13 of 17
JBerns
in reply to: JBerns

@ВeekeeCZ / @paullimapa,

 

I verified that the 'Capture" option was enabled in the PLOT dialog.

I plotted from the dialog and obtained a good PDF with readable dimensions using the Calibri font.

I then plotted from the command line and produced a similar PDF.

 

I closed AutoCAD and then searched the system registry for both "AcQuickPublishOpts" and "CaptureFontsInDrawing".

Neither of these could be found.

 

I am not sure how I was able to produce a good PDF using the command line if these registry settings are not available.

 

Reminder, there is no question about font capturing when doing a detailed plot from the command line.

Thoughts or suggestions to ensure fonts are captured when producing PDFs from the command line?

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 14 of 17
paullimapa
in reply to: JBerns

You were able to produce the good pdf because as I had replied in my previous post as long as your plot device pdf options is set to capture then you’ll succeed. Those other settings @ВeekeeCZ mentioned will only appear in the registry if you used at least once the ExportPDF command and made changes to the pdf options under that window. Again currently there’s no Autolisp method to set the pdf options within a printer device.  This requires user input which is what you did as the first step before running your lisp. Now another possible workaround would be to use @ВeekeeCZ method to set the exportpdf pdf options and run the -Export command line version to generate a pdf. But you’ll lose the center option since export doesn’t have this option. A workaround for that would require you to setup everything exactly as you want in a layout then you would not require centering. Let me know if you want to try out that lisp option 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 15 of 17
JBerns
in reply to: paullimapa

@paullimapa,

 

Acknowledged. Thanks for clarifying.

We keep our PC3 files in a shared server folder, so as long as no user makes any changes, we should have this issue resolved.

 

I was hoping that I might be assured the font capture option was set each time before plotting, but seems to be difficult from an AutoLISP perspective.

 

We shall proceed and hope the PDF files will continue to capture fonts to ensure readable dimensions.

Thanks again, Paul.

 

Regards,

Jerry

 

-----------------------------------------------------------------------------------------
CAD Administrator
Using Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 16 of 17
paullimapa
in reply to: JBerns

glad to have helped...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 17 of 17
rajoy61023
in reply to: JBerns

 

In AutoLISP, you can control plot settings using the setenv function to set system variables. For PDF plotting, you might want to consider the PLOTCONFIG system variable. Here's an example of how you might use AutoLISP to set the 'capture' option for PDF plotting:

 

lispCopy code
(defun set-pdf-plot-capture () (setenv "PLOTCONFIG" "PDF.pc3") (setenv "PLOTOPTIONS" "Capture") ) (set-pdf-plot-capture)
 

This example assumes that "PDF.pc3" is the plot configuration file you want to use, and "Capture" is the desired option for the 'capture' setting.

However, please note that the availability of specific options and system variables may vary depending on the AutoCAD version and the specific requirements of your project.

As for the additional keyword you provided, "Download Islamic PDF Books," please note that I can't assist with any requests or actions related to downloading copyrighted materials or any content that violates ethical or legal standards. If you have any non-infringing questions or need further clarification, feel free to ask.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report