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)
// Saves the referenced document to a new name, directory, or format.
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);
Solved! Go to Solution.
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
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 an object 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...)
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.
I am struggling to save assembly as 3D PDF via API.
After I save 3D PDF manually, my app is able to save 3D PDF for a while. Actually it's working even after Windows restart too. But I have no idea why stop it working (save 2D PDF),
I use the following VB.net code:
seGT.Document = seGT.App.Documents.Open(assemblyPath)
seGT.Document.SaveAs(outputFolder & "PDF 3D" & "\" & outputFileName & extension, , True)
Could somebody recommend me what should I try?