If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
ExportAsFixedFormat
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.PbFixedFormatTy pe.pbFixedFormatTypePDF, pdfPath /* Filename*/, Microsoft.Office.Interop.Publisher.PbFixedFormatIn tent.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.pb PrintStyleDefault, Microsoft.Office.Interop.Publisher.PbPrintStyle.pb PrintStyleOnePagePerSheet, // the above do not work either. false /* DocStructureTags */ , false /* BitmapMissingFonts */ , false /* UseISO19005_1 */ , null /* ExternalExporter */ ); Thanks John |
#2
|
|||
|
|||
ExportAsFixedFormat
Q. John Chen wrote:
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.PbFixedFormatTy pe.pbFixedFormatTypePDF, pdfPath /* Filename*/, Microsoft.Office.Interop.Publisher.PbFixedFormatIn tent.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.pb PrintStyleDefault, Microsoft.Office.Interop.Publisher.PbPrintStyle.pb PrintStyleOnePagePerSheet, // the above do not work either. false /* DocStructureTags */ , false /* BitmapMissingFonts */ , false /* UseISO19005_1 */ , null /* ExternalExporter */ ); Thanks John Sure looks like a problem with Publisher, thanks for asking.... |
#3
|
|||
|
|||
ExportAsFixedFormat
On Mar 5, 10:14 pm, Steve in NC wrote:
Q. John Chen wrote: 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.PbFixedFormatTy pe.pbFixedFormatTypePDF, pdfPath /* Filename*/, Microsoft.Office.Interop.Publisher.PbFixedFormatIn tent.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.pb PrintStyleDefault, Microsoft.Office.Interop.Publisher.PbPrintStyle.pb PrintStyleOnePagePerSheet*, // the above do not work either. false /* DocStructureTags */ , false /* BitmapMissingFonts */ , false /* UseISO19005_1 */ , null /* ExternalExporter */ ); Thanks John 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 |
#4
|
|||
|
|||
ExportAsFixedFormat
On Mar 5, 11:46 pm, "Q. John Chen" wrote:
On Mar 5, 10:14 pm, Steve in NC wrote: Q. John Chen wrote: 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.PbFixedFormatTy pe.pbFixedFormatTypePDF, pdfPath /* Filename*/, Microsoft.Office.Interop.Publisher.PbFixedFormatIn tent.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.pb PrintStyleDefault, Microsoft.Office.Interop.Publisher.PbPrintStyle.pb PrintStyleOnePagePerSheet**, // the above do not work either. false /* DocStructureTags */ , false /* BitmapMissingFonts */ , false /* UseISO19005_1 */ , null /* ExternalExporter */ ); Thanks John 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. |
#5
|
|||
|
|||
ExportAsFixedFormat
On Mar 6, 12:05 am, "Q. John Chen" wrote:
On Mar 5, 11:46 pm, "Q. John Chen" wrote: On Mar 5, 10:14 pm, Steve in NC wrote: Q. John Chen wrote: 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.PbFixedFormatTy pe.pbFixedFormatTypePDF, pdfPath /* Filename*/, Microsoft.Office.Interop.Publisher.PbFixedFormatIn tent.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.pb PrintStyleDefault, Microsoft.Office.Interop.Publisher.PbPrintStyle.pb PrintStyleOnePagePerSheet***, // the above do not work either. false /* DocStructureTags */ , false /* BitmapMissingFonts */ , false /* UseISO19005_1 */ , null /* ExternalExporter */ ); Thanks John 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.- Hide quoted text - - Show quoted text - I finally figured out: Use System.Reflection.Missing.Value as the last argument instead null. |
Thread Tools | |
Display Modes | |
|
|