ExportAsFixedFormat

Q

Q. John Chen

All,

I am using .NET/C# try to automate the export to pdf process. But
always got:
System.ArgumentException: Value does not fall within the expected
range.
There are so many arguments and I don't know which one causes the
problem.
Following are the arguments.

document.ExportAsFixedFormat(

Microsoft.Office.Interop.Publisher.PbFixedFormatType.pbFixedFormatTypePDF,
pdfPath /* Filename*/,

Microsoft.Office.Interop.Publisher.PbFixedFormatIntent.pbIntentPrinting,
false /* IncluceDocumentProperties */ ,
0 /*300*/ /* ColorDownsampleTarget */, // was using 300
dpi as found when I manually export.
0 /*450*/ /* ColorDownsampleThreshold */,
0 /*1200*/ /* OneBitDownsampleTarget */ ,
0 /*1800*/ /* OneBitDownsampleThreashold */,
1 /* From */ ,
document.Pages.Count /* To */ , // I tried
document.Pages.Count - 1 in case it's 0 based
1 /* Copies */ ,
false /* Collate */ ,
//
Microsoft.Office.Interop.Publisher.PbPrintStyle.pbPrintStyleDefault,

Microsoft.Office.Interop.Publisher.PbPrintStyle.pbPrintStyleOnePagePerSheet, //
the above do not work either.
false /* DocStructureTags */ ,
false /* BitmapMissingFonts */ ,
false /* UseISO19005_1 */ ,
null /* ExternalExporter */ );

Thanks

John
 
Q

Q. John Chen

Sure looks like a problem with Publisher, thanks for asking....- Hide quoted text -

- Show quoted text -


I also tried to put all the default value (by looking the object
browser in Publisher VB IDE - see below). Most values are -1 by
default instead of 0 which I thought was the default. But still give
me the same error.

Following is copied from the object browser.
Sub ExportAsFixedFormat(Format As PbFixedFormatType, Filename As
String, [Intent As PbFixedFormatIntent = pbIntentPrinting],
[IncludeDocumentProperties As Boolean = True], [ColorDownsampleTarget
As Long = -1], [ColorDownsampleThreshold As Long = -1],
[OneBitDownsampleTarget As Long = -1], [OneBitDownsampleThreshold As
Long = -1], [From As Long = -1], [To As Long = -1], [Copies As Long =
-1], [Collate As Boolean = True], [PrintStyle As PbPrintStyle =
pbPrintStyleDefault], [DocStructureTags As Boolean = True],
[BitmapMissingFonts As Boolean = True], [UseISO19005_1 As Boolean =
False], [ExternalExporter])

I tried the same with A MACRO IN PUBLISHER (by providing all the
default values) - no problems.

So, my next question is: How can invoke a macro from .NET?

Thanks

John
 
Q

Q. John Chen

Sure looks like a problem with Publisher, thanks for asking....- Hide quoted text -
- Show quoted text -

I also tried to put all the default value (by looking the object
browser in Publisher VB IDE - see below). Most values are -1 by
default instead of 0 which I thought was the default. But still give
me the same error.

Following is copied from the object browser.
Sub ExportAsFixedFormat(Format As PbFixedFormatType, Filename As
String, [Intent As PbFixedFormatIntent = pbIntentPrinting],
[IncludeDocumentProperties As Boolean = True], [ColorDownsampleTarget
As Long = -1], [ColorDownsampleThreshold As Long = -1],
[OneBitDownsampleTarget As Long = -1], [OneBitDownsampleThreshold As
Long = -1], [From As Long = -1], [To As Long = -1], [Copies As Long=
-1], [Collate As Boolean = True], [PrintStyle As PbPrintStyle =
pbPrintStyleDefault], [DocStructureTags As Boolean = True],
[BitmapMissingFonts As Boolean = True], [UseISO19005_1 As Boolean =
False], [ExternalExporter])

I tried the same with A MACRO IN PUBLISHER (by providing all the
default values) - no problems.

So, my next question is: How can invoke a macro from .NET?

Thanks

John- Hide quoted text -

- Show quoted text -

Here is my work around: Create a macro for document_close() event in
publisher and the .net simply open and close the document.
 
Q

Q. John Chen

I also tried to put all the default value (by looking the object
browser in Publisher VB IDE - see below). Most values are -1 by
default instead of 0 which I thought was the default. But still give
me the same error.
Following is copied from the object browser.
Sub ExportAsFixedFormat(Format As PbFixedFormatType, Filename As
String, [Intent As PbFixedFormatIntent = pbIntentPrinting],
[IncludeDocumentProperties As Boolean = True], [ColorDownsampleTarget
As Long = -1], [ColorDownsampleThreshold As Long = -1],
[OneBitDownsampleTarget As Long = -1], [OneBitDownsampleThreshold As
Long = -1], [From As Long = -1], [To As Long = -1], [Copies As Long =
-1], [Collate As Boolean = True], [PrintStyle As PbPrintStyle =
pbPrintStyleDefault], [DocStructureTags As Boolean = True],
[BitmapMissingFonts As Boolean = True], [UseISO19005_1 As Boolean =
False], [ExternalExporter])
I tried the same with A MACRO IN PUBLISHER (by providing all the
default values) - no problems.
So, my next question is: How can invoke a macro from .NET?

John- Hide quoted text -
- Show quoted text -

Here is my work around: Create a macro for document_close() event in
publisher and the .net simply open and close the document.- Hide quoted text -

- Show quoted text -

I finally figured out: Use System.Reflection.Missing.Value as the last
argument instead null.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top