Hello to all,
Welcome to the new edition of the SOLIDWORKS Support Monthly News! This monthly news blog is co-authored by members of the SOLIDWORKS Technical Support teams worldwide.
Configuring the SOLIDWORKS PDM ‘Draftsight to PDF’ task to use options such as ‘Print Style Table’, ‘Use Layers in PDF file’, ‘Custom bitmap resolution’ and ‘Embedded True Type Fonts’.
By Petr Sadlo
The SWPDFTaskAddIn allows user to generate PDF file from DraftSight. However, until DraftSight 2018 there was no API exposed in order to control the various options such as ‘Print Style Table’, ‘Use Layers in PDF file’, ’Custom bitmap resolution’ and ‘Embedded True Type Fonts’ that are available when exporting PDF from DraftSight manually using the DraftSight UI.
The SWPDFTaskAddIn utilize the ‘Export’ > ‘PDF Export’ option from DraftSight.
The following example demonstrate the script modification needed to control those options. This script modification is valid for SWPDM2019sp4 or newer as it utilizes new DraftSight API call ExportToPDF2 that is not present in previous versions of ‘DraftSight.Interop.dsAutomation.dll’ distributed with SOLIDWORK PDM. Also make sure that the task Add-In (SWPDFTaskAddIn) is updated to 2019sp4 version.
Confirm that your ‘DraftSight.Interop.dsAutomation.dll’ is at least 2019. Right mouse click on ‘DraftSight.Interop.dsAutomation.dll’ located in ‘%appdata%\SWPDFTaskAddIn’, select ‘Properties’ and on the ‘Details’ tab make sure that the ‘File version’ starts with at least with 2019
Upgrade DraftSight Interop process
The ‘DraftSight.Interop.dsAutomation.dll’ is part of the SWPDFTaskAddIn. For example, for the SWPDM2019sp3 Add-In the DraftSight.Interop.dsAutomation.dll is the outdated 2014 version as shown below:
You can upgrade the client by installing SWPDM2019sp4 or you can also upgrade the Task Add-In only by drag and drop the Add-In from 2019sp4 DraftSight_to_PDF_gb.cex into your 2019sp0-sp3 vault as shown below:
1. Open the ‘DraftSight to PDF’, ‘Output PDF Details’ and press the ‘Advanced Scripting Options’ to access the task script.
2. Locate the section towards the end of the script where the script defines which sheet to select preceding with comment (‘define which sheet to select) and modify the code as indicated below:
3. Press OK and thoroughly test the change.
Options and settings from the DraftSight API help that are now avaliable for the ExportToPdf2 call:
You can find this information as a part of KB solution S-076456 – ‘In SOLIDWORKS® PDM, how do I configure the ‘DraftSight to PDF’ task to use the ‘Print Style Table’, ‘Use Layers in PDF file’, Custom bitmap resolution’ and ‘Embedded True Type Fonts’ options?’
Noteworthy Solutions from the SOLIDWORKS Knowledge Base
When I start SOLIDWORKS® Visualize, why do I see the error ‘SOLIDWORKS Visualize has encountered an error’?
For more information, see Solution Id: S-077448.
Why do changes I make in the SOLIDWORKS® Electrical ‘Application Settings’ dialog box not save when closing and restarting the application?
For more information on this, see Solution Id: S-077497.
When using a search card in the SOLIDWORKS® PDM 2019 SP5 software, what can cause the search to fail with the error ‘Could not access the item in the database’?
For more information, see Solution Id: S-077467.
In SOLIDWORKS® Plastics, what is the location of the ‘Runner Balancing’ option?
For more information on this, see Solution Id: S-077469.
Does using radiation in a vacuum in the SOLIDWORKS® Flow Simulation application always require meshing of the vacuum region?
For more information, check out Solution Id: S-077547.
That’s it for this month. Thanks for reading this edition of SOLIDWORKS Support News. If you need additional help with these issues or any others, please contact your SOLIDWORKS Value Added Reseller.
Comments and suggestions are always welcome. You can enter them below.