.NET

Reply
Active Contributor
manoajco
Posts: 34
Registered: ‎08-22-2013
Message 1 of 5 (121 Views)

HOw can i give Custom sheet size while converting DWG to PDF

121 Views, 4 Replies
04-29-2014 03:32 AM

Hi,
I Am trying to convert DWG(sheet size:A2*3) to PDF(sheet size:A2*3) file by using the below code

moActiveDoc = moAcadApp.GetType().InvokeMember("ActiveDocument",
BindingFlags.GetProperty, null, moAcadApp, null);

oActiveLayout = moActiveDoc.GetType().InvokeMember("ActiveLayout", System.Reflection.BindingFlags.GetProperty, null, moActiveDoc, null);

object[] oParams[0]="ISO_A0_(1189.00_x_841.00_MM";

oActiveLayout.GetType().InvokeMember("CanonicalMediaName",System.Reflection.BindingFlags.SetProperty, null, oActiveLayout, oParams);


but
oActiveLayout.GetType().InvokeMember("CanonicalMediaName",System.Reflection.BindingFlags.SetProperty, null, oActiveLayout, oParams);

its gives the error "invalid Input" becouse the oParams[0] value="ISO_A0_(1189.00_x_841.00_MM)",It works perfectly if i give the
oParams[0] ="ISO_A1_(594.00_x_841.00_MM)" (for A1 sheet size).

My Query is how can i give the custom sheet size value(A2*3)?

 

PLat form:C# .Net

OS=Windows 7 ,32 bit

 

Thanks in Advance

Valued Contributor
Ron_M
Posts: 74
Registered: ‎12-09-2013
Message 2 of 5 (89 Views)

Re: HOw can i give Custom sheet size while converting DWG to PDF

04-30-2014 10:30 AM in reply to: manoajco

Without looking too far into what you have I had a long topic about custom sheet sizes.  There might be something helpful in there.  Basically our office uses all custom sheet sizes for plotting PDFs and I needed to come up with a way to do that.  With a lot of help from multiple people here I was able to convert the LocalMediaName to CanonicalMediaName.

 

Use Local Media Name

 

 

Active Contributor
manoajco
Posts: 34
Registered: ‎08-22-2013
Message 3 of 5 (69 Views)

Re: HOw can i give Custom sheet size while converting DWG to PDF

05-01-2014 10:26 PM in reply to: Ron_M

Thanks Ron_M,
Am not expertise in canonical methodes.I Will shorten the question
for A2*3 sheets i am uisng the string=ISO_A1_(594.00_x_841.00_MM) .That returns the error.so Instead of that which string i can use?


Note:for A1 sheet string is="ISO_A1_(594.00_x_841.00_MM)".it works perfectly.

 

PLease Help

 

Thanks ,

Manosh

Valued Contributor
Ron_M
Posts: 74
Registered: ‎12-09-2013
Message 4 of 5 (60 Views)

Re: HOw can i give Custom sheet size while converting DWG to PDF

05-02-2014 04:37 AM in reply to: manoajco
So my understanding is that your A2*3 sheet size is custom correct? If that is so the sheet size is LOCALMEDIANAME. In order to use it you have to convert LOCALMEDIANAME to CANONICALMEDIANAME. Otherwise it will be looking for a size that is actually a "UserXXX" which was assigned to the custom size as its CANONICALMEDIANAME. All of that is laid out in my thread linked above.

If I'm wrong about it being a custom size created by you then I don't know at this time and I apologize for wasting your time.
Active Contributor
manoajco
Posts: 34
Registered: ‎08-22-2013
Message 5 of 5 (52 Views)

Re: HOw can i give Custom sheet size while converting DWG to PDF

05-02-2014 09:53 PM in reply to: Ron_M

Thanks  Ron_M,

 

I think You are in right track.But the issue is am not getting you properly.

The methode which i using to convert is

 

oActiveLayout.GetType().InvokeMember("CanonicalMediaName",System.Reflection.BindingFlags.SetProperty, null, oActiveLayout, oParams);

and the oParams[0]= ISO_A0_(1189.00_x_841.00_MM).

 

I have gone through your thred and i am not getting any proper guidence from that.Can u please give some more details regarding LocalMediaName and how can i implement in my code Snippet.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!