Help saving draft as a pdf

Experimenter
Experimenter

Hello,

 

I need help saving draft documents as a pdf file. I am processing these documents as a batch and do not want prompts. I have tried using the SaveAs method of the DraftDocument object and nothing will get saved, like so:

 

objActiveDocDraft.SaveAs(NewName:=strOutputPath + strOutputName + ".pdf", FileFormat:=False)

 

Changing FileFormat to True causes it to spit out a small window asking for the output file name. This will save a pdf, but I do not want this prompt. Other pdf printers generate prompts outside the program as well. PrintOut has caused me issues as well.

 

If someone knows a way to save a draft document as a pdf file that actually works (without prompts) I would be grateful.

4 REPLIES

Re: Help saving draft as a pdf

Legend
Legend

Hello BurgerWorld,

try this:

objActiveDocDraft.SaveAs(PathFilename & ".pdf")

You need no other parameters. To concatenate Strings in VB it is better if you use "&" i think.

If you want to supress any user prompts you can use

objApp.DisplayAlerts = False

but dont forget to turn on alerts when you're done

objApp.DisplayAlerts = True

 

Greetings from Germany

 

Christian

 

Greetings from Germany
Christian Kunkel
https://c-k-m.info

Re: Help saving draft as a pdf

Experimenter
Experimenter

In VB.Net the '+' character works for concatenating strings. I did try simply using the filename parameter and it still did not work. I do appreciate the suggestions nonetheless.

 

Also, I want to note the Solid Edge Velocity printer is installed. I have tried using PrintOut, but if the PrintToFile parameter is set to True I am prompted to give the filename (really the filename and path). This will allows me to save a document, but I want the document to save to what OutputFileName has specified. The Solid Edge Velocity printer generates this prompt, by the way. If I do not use the PrintToFile parameter, it does not save any files at all.

 

I would appreciate further help if anyone can offer it.

Re: Help saving draft as a pdf

PLM World Member Genius PLM World Member Genius
PLM World Member Genius

We are using code very similar to ckunkel72 that works.

 

Dim objDraftFile As SolidEdgeDraft.DraftDocument
Dim pdfFile As String = Path.Combine(strWorkFolder, _drawingData.DocumentNumber & ".pdf")


objDraftFile = _appSolidEdge.Documents.Open(Path.Combine(strWorkFolder, _drawingData.DraftFileName))

objDraftFile.SaveAs(pdfFile)

We did find that you need to have the correct options file already in place to control the options.  Also sometimes you have to check to see if the file is locked (done saving) before you move it.  Otherwise, SaveAs should work for creating PDF.

Re: Help saving draft as a pdf

PLM World Member Genius PLM World Member Genius
PLM World Member Genius

BurgerWorld.

Did you try taking out "FileFormat:=False"?

 

According to the documentation none of the optional parameters for SaveAs are supported.  Only the NewName parameter.

 

FileFormat

Not currently supported.