Powershell Invoke-WebRequest下载Tableau Sheet为PDF错误

时间:2017-01-20 19:11:57

标签: powershell pdf scripting tableau tableau-server

我正在尝试使用PowerShell将tableau工作表下载为pdf。为什么不使用tabcmd实用程序?因为我们无法访问它(安全原因)。我正在使用这种方法:

Invoke-WebRequest http://serverName/File/Path/views/workbook/worksheet.pdf -OutFile Test.pdf -UseDefaultCredentials

此EXACT方法/语法适用于某些工作表,但不适用于其他工作表。如果它不起作用,就会吐出这个巨大的混乱错误:

  

Invoke-WebRequest:%PDF-1.4% 10 obj<< / Creator(Tableau   Windows 5.1上的0.9.227.200>> endobj 2 0 obj<< /类型/目录/页3 0 R>> endobj 4 0 obj<< / Type / XObject / Subtype / Form / FormType 1   / Group<< / Type / Group / S / Transparency / CS / DeviceRGB / I false / K.   false>> / Resources<< / Font 6 0 R / XObject 7 0 R / ExtGState 8 0 R.   /阴影9 0 R> / BBox [0 0 518 443] /长度5 0 R>流1 0 0 1   0 443 cm 1 0 0 1 0 -0 cm 1 0 0 1 0 -0 cm 0.75 0 0 0.75 0 0 cm 1 1 1 rg   0 -591 691 591 re f q 8 -185 675 171 re W n 1 0 0 1 8 -185 cm 640 0 0   163 0 0 cm 1.0546875 0 0 1.049079755 0 0 cm 1 0 0 1 0 0 cm / IM0 Do Q 0   0 0 rg q 8 -278 675 78 re W n q 1 0 0 1 8 -200 cm 1.00000 -0.00000   0.00000 1.00000 0 0 cm BT %%产生图像的问题/ TT0 21 Tf 228 -47 Td< 0033> Tj 14 0 Td< 0055> Tj 7 0 Td< 0052> Tj 12 0 Td Tj ET Q Q.   endstream endobj 5 0 obj 841 endobj 10 0 obj<< / Type / Font / Subtype   / Type0 / BaseFont / Arial / Encoding / Identity-H / DescendantFonts [11 0   R]>> endobj 11 0 obj<< / Type / Font / Subtype / CIDFontType2   / BaseFont / Arial / FontDescriptor 12 0 R / CIDSystemInfo<< /订购   (身份)/注册表(Adobe)/补充0>> >> endobj 12 0 obj<<   / Type / FontDescriptor / FontName / Arial / FontBBox [-2000 -2000 4000   4000 / Flags 4 / FontFile2 13 0 R> endobj 13 0 obj<< /长度14 0 R   / Length1 15 0 R / Filter / FlateDecode>>流x } @ 6   3E°((2(L2 “{fiiK” * LSI [_iV.e0s    Z o = r {在线:1字符:1   + Invoke-WebRequest ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       + CategoryInfo:InvalidOperation:(System.Net.HttpWebRequest:HttpWebRequest)[Invoke-WebRequest],   引发WebException       + FullyQualifiedErrorId:WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

有谁知道这样的错误是什么意思?

1 个答案:

答案 0 :(得分:0)

您可以自行发布异常消息,例如:

try {
    invoke-webrequest <blah de blah>;
    }
catch [System.Exception] { 
    Write-Host -Object $_.Exception.Message;
    } 
相关问题