How to SaveAs 3D PDF?

Creator
Creator

Hello everybody!

 

Does anybody know how to save a document as 3D PDF via interop?

 

Usually SE infers the file format from the file name extension I pass to the SaveAs method. e.g. when I pass "test.stp" I'll get a STEP file, "test.igs" an IGES file and so on. Now the problem is that both, the normal PDF and the 3D PDF have the same ".pdf" extension and whenever I call SaveAs("test.pdf") I'll get the normal PDF format.

 

I guess I have to pass the optional parameter FileFormat to the SaveAs method but don't know which enum or class type the method is expecting there. It only says "object FileType". What do I have to pass there to get a 3D PDF? Or is there any other way? e.g. by using the Velocity printer or the PDF_CREATE_3D flag in the registry? (which did not work for me)

 

//
// Summary:
// Saves the referenced document to a new name, directory, or format.
[DispId(35)]
void SaveAs(string NewName, object IsATemplate = Type.Missing, object FileFormat = Type.Missing, object ReadOnlyEnforced = Type.Missing, object ReadOnlyRecommended = Type.Missing, object newstatus = Type.Missing, object CreateBackup = Type.Missing, object UpdateLinkInContainer = Type.Missing, object UpdateAllLinksInContainer = Type.Missing);

 

Thanks!

tole

 

 

4 REPLIES

Re: How to SaveAs 3D PDF?

Solution Partner Legend Solution Partner Legend
Solution Partner Legend

Hello tole,

 

Passing true as value for the parameter FileFormat will create a 3D PDF for a given NewName with extension .pdf

 

 

Kind regards,
Wolfgang Kunert - www.wksyspro.de

Re: How to SaveAs 3D PDF?

Creator
Creator

Hello wku,

 

oh well, today it is working, yesterday it wasn't -.-  Guess I haven't compile something...

 

Here the solution again for all others:

 

document.SaveAs("test.pdf", Type.Missing, true));   // generates a 3D PDF

 

document.SaveAs("test.pdf") or document.SaveAs("test.pdf", Type.Missing, false));   // generates a normal PDF

 

Thanks

tole

 

Re: How to SaveAs 3D PDF?

Phenom
Phenom

Wonderful ! Works like a charm !!

 

At the same time it gives immense pain to realize that it is so unintuitive to dig out such options, unless of course it is well documented somewhere which can be searched and found out easily.

 

Otherwise setting a FileFormat argument defined as a Boolean to get a 3D or non-3D output calls for some really wild imagination or insane trial-and-error.

 

IMO this should have been a clear SaveAsPDF with an argument defined as constant 3DPDF or Flat or else a separate function SaveAs3DPDF(PDFFileName, more arguments...)

Re: How to SaveAs 3D PDF?

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Good stuff. I'll add a SaveAsPdf() (2D & 3D) extension method to the SolidEdge.Community NuGet package. That way, this knowledge is captured and can be easily referenced in the future.

Jason Newell
Applications Architect
www.jasonnewell.net