View Full Version : Automatic PDF-ing. Even possible?
schrodingerscat
2009-01-05, 03:51 AM
I've been writing a program for a while now which is supposed to make our current PDF-ing practices a lot easier. At the moment we plot to a PDFCreator/PDFMachine virtual printer and it spits out a PDF. We then sit there for ages renaming the PDFs to match our naming convention which ends in the drawing's revision. The program I'm writing opens each drawing, finds the titleblock, extracts the drawing number and revision, plots to an EPS file, and then uses PDFCreator with command line arguments to output a file in the correct directory with the correct name.
Doesn't seem to work. Even performing it manually.
First problem: Can't find an easy way to plot to an EPS file with plot styles (Don't want to assume that everyone has the same way to plot to EPS as me because I know they don't)
Second problem: Doesn't matter if I use Acrobat Distiller or PDFCreator to convert the EPS file to PDF, it will only convert the bottom left hand corner (A4 size chunk) of the drawing (A1 size).
Any ideas from anyone?
steve.ashton
2009-01-05, 04:32 AM
I have set up my pdf to plot from a script and have set the default file name to be the drawing/tab. You can set a default path for the pdf files.
Knowing the name & location, you should then be able use the vl-file-rename in a lisp program at the end of the script to rename the file.
schrodingerscat
2009-01-05, 04:42 AM
At the moment I don't even know how to get it to PDF (remembering that I'm writing this program for use around the company and the software from on computer to another let alone different offices is different). I only want to work with what someone would have at their disposal on a brand new drafting computer with just AutoCAD installed. At the very most I would assume that since PDFCreator is what we were instructed to use that all offices would have it.
I can plot to PDFCreator but I always get the save screen which is one of the main annoyances I'm trying to get rid of. The problem is that I can't find a way to bypass this screen without turning on Autosave (which would create a larger setup time for users).
steve.ashton
2009-01-05, 04:49 AM
When you install pdfcreator there is an executable installed that lets you set the configuration. You can set the auto name on, choose the naming convention and the file location.
schrodingerscat
2009-01-05, 05:39 AM
The naming conventions included are not even remotely close to what we need. At the moment it's supposed to just default to the drawing file name, instead it defaults to the full file location with the "/"s changed to "_"s. So if I had a drawing c:\drawing.dwg with a layout "A1" it would name the PDF C:_Drawing A1.PDF
Since most of our drawings are saved under several subdirectories on network drives it's quicker to delete the default name and write it from scratch.
It's looking more and more like my only option is to include detailed setup instructions explaining to set PDFCreator to autosave to C:\pdf and then make my program find the last file saved in that directory, rename it with the job number, drawing number, and current revision, and then move it to the preselected folder before moving on to the next drawing.
There really needs to be an easier way to do this. Getting the entire industry to move away from PDFs and on to DWFs would be my first choice...
steve.ashton
2009-01-05, 07:01 AM
You can set pdfcreator to use the drawing name/layout without all the directory list.
Set it in the pdfcreator print monitor under autosave. I have used it previously.
As long as you know the location and file name you can rename it to what you want.
schrodingerscat
2009-01-05, 10:43 PM
On older jobs the drawing name will be wrong, and our layout name is the page size, we want it to be the job number (which wasn't included in the drawing title on older jobs) followed by the drawing number (depending on the client this could be completely different to the drawing title) followed by the current revision (only listed on the drawing). This isn't something you can do in PDFCreator. When it finds the title, it actually finds what is in the bar up the top of the screen which is the full path of the drawing. I've been looking into this problem for a while now, and even after contacting the programmers responsible for PDFCreator I have found that it just can't do what we need.
steve.ashton
2009-01-05, 11:37 PM
I used pdfcreator for some time before updating my computer a few months ago.
I had changed the autosave to <REDMON_DOCNAME_FILE> and this printed with the pdf name as the file name/tab without the c:\... etc. Maybe the new version is different.
You would need to use lisp to rename the file. On the old drawings are the job number and amendment held in atttributed blocks ? If so you can find these values with lisp and use to change file name. If it only text it would make it difficult, but if in fixed location you may be able to select.
Although I haven't done exactly what you are after I have done a few lisp programs some time ago with files and blocks etc. Are you familiar with lisp ? Most of work to rename would have to be done with lisp.
If you send me examples of the different formats I may be able to help out.
Steve Ashton
email sashton@iinet.net.au
schrodingerscat
2009-01-06, 04:26 AM
Actually renaming/moving the file is the easy part :
string OldPath = "C:\\pdf\\" + NewestFileName;
File.Move(@OldPath, @NewPath);
All I'm having problems with now is plotting. I figured out the problem but I haven't found a solution. It seems to come up with an error because the media I'm asking it to use doesn't exist. When I select PDFCreator in the plot dialog I can select "A1" from the page size area and all is well. I wrote some code to list all the media available to use when plotting to PDFCreator from C# and this is the output:
1 User1291
2 User2314
3 User1290
4 User1289
5 User2312
6 User1288
7 User1287
8 User2310
9 User1286
10 User2309
11 User1285
12 User2308
13 User1284
14 User2307
15 User1283
16 User1282
That is actually the output that I get when I tried one of our other plotters but it is basically the same. When I try it on one of the default Autodesk plotters eg. DWF6 ePlot.pc3 I get a list how it's meant to be with media sizes.
Any clue what's going on?
steve.ashton
2009-01-06, 09:32 PM
I haven't come across that one before.
Any time I have written plotting scipts they seem to find paper sizes ok.
At previous employer I used to copy scripts & .pc3's to about 15 computers for both normal plotters & pdf without problem.
Good luck
GettinBetter
2009-05-25, 03:35 PM
Just in case anyone hasn't found it (and I'm sure they will have by now), In 2010 there is a 'Batch Plot' in the Print options which allows you to batch plot to DWFx, PDF & local printer.
Options allow for single and multifiles, and destination, whereas local printer takes the setting from the DWG.
Filenames are preserved with the addition of 'Model' appended, but I just use a batch file to remove all those. 'Batched' 120 odd DWGs,. to both DWFx and PDF in under 3 mins the other day. Joy :)
Odd place to put this option, and I found it purely by exploration. Very handy though.
RobertB
2009-05-26, 06:50 PM
Just in case anyone hasn't found it (and I'm sure they will have by now), In 2010 there is a 'Batch Plot' in the Print options which allows you to batch plot to DWFx, PDF & local printer.
Options allow for single and multifiles, and destination, whereas local printer takes the setting from the DWG.
Filenames are preserved with the addition of 'Model' appended, but I just use a batch file to remove all those. 'Batched' 120 odd DWGs,. to both DWFx and PDF in under 3 mins the other day. Joy :)
Odd place to put this option, and I found it purely by exploration. Very handy though.Ironically, this feature has been around for years: Publish. For 2010 all Autodesk did was rename the panel's button to say "Batch Plot". It still executes Publish.
ethomson
2009-05-27, 11:47 AM
Ironically, this feature has been around for years: Publish. For 2010 all Autodesk did was rename the panel's button to say "Batch Plot". It still executes Publish.
Publish has been around but the ability to publish to PDF is a new feature, which is nice. Before you had to either have your page setups set to a PDF plotter by default (the page setup overrides never have worked well for me) or create a DWF and then create the PDF from the DWF. So that is nice
mike.127854
2009-06-17, 02:09 AM
All I'm having problems with now is plotting. It seems to come up with an error because the media I'm asking it to use doesn't exist. I wrote some code to list all the media available to use when plotting to PDFCreator from C# and this is the output:
1 User1291
2 User2314
<snip>
Any clue what's going on?
Make sure you're using GetAvailableMedia()'s returned values & not the keys, like so:
Dictionary<string, string> media = GetAvailableMedia(printerName);
List<string> mediaNames = new List<string>(media.Values);
List<string> mediaKeys = new List<string>(media.Keys);
where GetAvailableMedia() looks something like:
public static Dictionary<string, string> GetAvailableMedia(string DeviceName)
{
Dictionary<string, string> media = new Dictionary<string, string>();
PlotConfig pc = PCM.SetCurrentConfig(DeviceName);
pc.RefreshMediaNameList();
foreach (string str in pc.CanonicalMediaNames)
{
if (!media.ContainsKey(str))
{
media.Add(str, pc.GetLocalMediaName(str));
}
}
return media;
}
mediaNames has the list of media that you want, and mediaKeys has the list you showed above.
mike
--
Michael Kruger
KKL Pty Ltd
+61 8 9328 4780
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.