Part1Document.Open ("C:\Users\chojwa\Desktop\a\UT\VARIE\software\VBA programming\PDF\Stampa Automatica\DM 14-01-08 - tabella azioni variabili.pdf") Set Part2Document = CreateObject("AcroExch.PDDoc") Set Part1Document = CreateObject("AcroExch.PDDoc") Set AcroApp = CreateObject("AcroExch.App") I only know that those APIs are out there and babbled with them with the following basic example (but it makes you glimpse its potenitalities) I mean you can print and put all your needed pdfs (from word, excel, autocad.) in a certain folder and with proper names (accounting for their final publishing order) and then manage them (choosing proper files and or pages order) with a VBA macro that use PFD APIs which chooses files and it's pages order to create the final pdf dcoument Just in case you shouldn't make it the way you're struggling for, maybe a workaround by means of PDF APIs could help you. Voilà, here are my issues, congrats if you managed all of my stuff and thanks a lot to spend time for this ! When I try manually to run the Export command on AutoCAD directly (when I write the command and fill the settings myself), the Export command is well performed and a PDF appears. but the Export command is not performed by AutoCad. The issue is that on AutoCAD, when I run this code, I see that it appears on the "command status", it appears right, every setting fits right. ' Enter plot style table name (à mon avis il est facultatif si tu dis de pas prendre de plot.style) "Millimeters" & vbCr & "Landscape" & vbCr & "Fit" & vbCr & "Yes" & vbCr & "monochrome.ctb" & vbCr & "Yes" & vbCr & varFile & vbCr) VarFile = "T:\_USERS\ECOR\ProjetMacroPriorité1\DossierTest\vba"Ī ("-EXPORT" & vbCr & "PDF" & vbCr & "Extents" & vbCr & "Yes" & vbCr & TaillePapier & vbCr & _ Set AcadApp = GetObject(, "AutoCAD.Application")Ī = ("yoExportCommande", ".pdf") I even changed PlotRotation to see what would happen and the result was the same with every angle ! (strange isn't it wrote:Īnd about the SendCommand + Export, here is the code : I tried to move every setting int he code above but nothing changed. but the fact is that this code's result is not the same as the manually performed Plot : manual PDF is centered and VBA's PDF is larger and thus go a little outside of the paper. 'programmatically, and set the 'BACKGROUNDPLOT' system variableĭwg.SetVariable "BACKGROUNDPLOT", BackPlot 'If you wish you can delete the plot configuration you created ' Faire patienter le code 25 secondes le temps que le PDF soit créé (eh oui avec ce code ça prend 25 secondes)Īpplication.Wait Now + TimeValue("0:0:25") NomPDFenDWG = Replace(dwg.FullName, Left(dwg.name, Len(dwg.name) - 4), Ligne)Ī = PtObj.PlotToFile(Replace(NomPDFenDWG, "dwg", "pdf"), PlotConfig.ConfigName) 'Specifies whether or not to plot using the plot stylesīackPlot = dwg.GetVariable("BACKGROUNDPLOT") PlotConfig.ConfigName = "DWG To PDF.pc3" ' "PDFCreator" ne fonctionne pas 'The plot config you created become active 'Create a new plot configuration with all needed parameters Sub DWGtoPDF(dwg As AcadDocument, Ligne As String) I use "DWG to PDF.PC3" indeed, here is the code I have : Ah and I tried with a DWG with only 4 blocs inserted, it took 25 sec too. Furthermore, the export method is almost immediate so I'm a bit frustrated by the 25 sec. I know that I can make a Publish with every of them to earn a lot of time but the point is to make PDF from various documents (including DWG) from a list at the same time so I must use something that plot each DWG separately to keep the order. About the PlotToFile method duration, I didn't expect too much but if every of my 100 drawing takes so long it will take 25 minutes to have a PDF. Sorry if I left not enough informations about my issue. ?Īnd what code "does not work", I guess you have to show it so we can look into it and try it on our systems. What means "does not work"? Crash? Error message? Incorrect PDF content? Anything else. > when I do it manually on AutoCad but it doesn't work via VBA It depends on file content, on amount of text (and how it is handled) and the settings in "DWG to PDF.PC3" (or whatever driver you use), can you show a drawing and it's settings (run _ETRANSMIT so we get your PC3 and PMP if there is one assigned). PlotToFile, it works but it takes 25 sec.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |