Hi,
I'm using Aspose.pdf.dll in C# (version 4.6)
And I get this error almost every time (sometimes it is working).
It is failing at this statement: pdf1.Save(pdfStream);
Error is:
"The remote server returned an error: (404) Not Found."
My code is this:
public Stream Convert(Stream xmlStream, Generator generator)
{
using (var temp = new MemoryStream())
{
CopyStream(xmlStream, temp);
xmlStream.Close();
switch (generator)
{
case Generator.Aspose:
string licenseLocation = ConfigurationManager.AppSettings["AsposeLicenseFileLocation"];
if (!string.IsNullOrEmpty(licenseLocation))
{
new License().SetLicense(licenseLocation);
}
var pdfStream = new MemoryStream();
Pdf pdf1 = new Pdf();
pdf1.BindXML(temp, null);
pdf1.Save(pdfStream);
pdfStream.Seek(0, SeekOrigin.Begin);
return pdfStream;
default:
temp.Seek(0, SeekOrigin.Begin);
return RetrieveFromStream(temp);
}
}
}
Do you have any idea why it is failing?
stack trace is:
at x3f91538e8c0de749.x8cc6f4ae84548c02.xd3dfacf9ced05630(Pdf x6beba47238e0ade6, Section x4c742376f4cbaf27, Table x1ec770899c98a268, Cell xe6de5e5fa2d44af5, Image xe058541ca798c059, x33eef31791ddfc27 xb4012f98512a2f3d, xbfecfdaff4b493fe x96b3b0aca69853de)
at x3f91538e8c0de749.x3ea0b5a11618c323.x86d515adc7a0a302(Pdf x6beba47238e0ade6, Section x4c742376f4cbaf27, HeaderFooter x105be60320c854bc, Table x1ec770899c98a268, Row xa806b754814b9ae0, Cell xe6de5e5fa2d44af5, Image xe058541ca798c059, x33eef31791ddfc27 xb4012f98512a2f3d, xbfecfdaff4b493fe x96b3b0aca69853de, Boolean x70e701cee22724e3)
at x3f91538e8c0de749.x1d988ade36b9e532.xc2bbf1463ef5659c(Pdf x6beba47238e0ade6, Section x7468108b15101a6d, HeaderFooter x105be60320c854bc, x33eef31791ddfc27 xe85f69f7a9a5aa23, Boolean x59c6d00e0898f6b8)
at x3f91538e8c0de749.x81ca8aa6690c7e90.xc2bbf1463ef5659c(Pdf x6beba47238e0ade6, Section xb32f8dd719a105db, x33eef31791ddfc27 xb4012f98512a2f3d, Int32 x505d07ee689e0cb8)
at x3f91538e8c0de749.x7576dadd7c449efa.x8810991188d773db(Pdf x6beba47238e0ade6, Section xb32f8dd719a105db, x33eef31791ddfc27 xb4012f98512a2f3d)
at x3f91538e8c0de749.x6a7cd842e95518d7.xc5e548c04b18e6e2(Pdf x6beba47238e0ade6)
at x3f91538e8c0de749.xaa36f84dba9d652f.x5ec1518f85fc1bbf(xb912e9429339cb81 x80010f902a1f736e, Pdf x6beba47238e0ade6)
at Aspose.Pdf.Pdf.Save(Stream stream)
at BCA.PEEP.Services.Processes.DocConverter.Repositories.PdfRepository.Convert(Stream xmlStream, Generator generator) in c:\TFS\PEEP\src\Main\Source\BCA.PEEP.Services.Repositories\DocConverter\PdfRepository.cs:line 122
at BCA.PEEP.Services.Processes.DocConverter.Operations.DocConverterProcess.ConvertToPdfStream(ConvertToPdfStreamRequest request) in c:\TFS\PEEP\src\Main\Source\BCA.PEEP.Services.Processes\DocConverter\Operations\DocConverterProcess.cs:line 192
And this is the input xml file
<?xml version="1.0" encoding="UTF-8"?>
<Pdf xml:space="preserve" TabStopPosition="21" IsCoreFontUsed="false" IsPageNumberForDocument="true" xmlns="Aspose.Pdf">
<Section PageWidth="612" PageHeight="840" PageMarginTop="60" PageMarginBottom="60" PageMarginLeft="30" PageMarginRight="30" IsNewPage="false">
<Header MarginTop="20" MarginBottom="0">
<Table ID="Content" ColumnWidths="40 130 170 200" MarginLeft="0" DefaultCellPaddingLeft="0" DefaultCellPaddingRight="0" DefaultCellPaddingTop="1" DefaultCellPaddingBottom="8" IsBroken="false" IsRowBroken="false" IsFirstRowRepeated="false">
<Row>
<Cell PaddingTop="0" PaddingLeft="0" PaddingRight="0" Alignment="Left" VerticalAlignment="Left">
<Image File="http://localhost/Images/PDF/AlphabetPoland.jpg" Type="Jpeg" />
</Cell>
<Cell PaddingLeft="2" PaddingRight="2" Alignment="Left" VerticalAlignment="Left">
</Cell>
<Cell>
</Cell>
<Cell PaddingTop="0" PaddingLeft="2" PaddingRight="2" Alignment="Right" VerticalAlignment="Right">
</Cell>
</Row>
<Row >
<Cell ColumnsSpan="4">
<Text IsSpaced="true" LineSpacing="1.8" BackgroundColor = "#f5f5f5">
<Segment FontName="Arial" IsTrueTypeFontBold="true" FontSize="6"></Segment>
</Text>
</Cell>
</Row>
</Table>
</Header><Table ID="Content" MarginLeft="0" DefaultCellPaddingTop="0" DefaultCellPaddingRight="2.75" DefaultCellPaddingBottom="1" DefaultCellPaddingLeft="2.75" IsRowBroken="true" IsFirstRowRepeated="true">
<Row>
<Cell PaddingLeft="0" PaddingRight="0">
<Table ID="Content" ColumnWidths="130 30 30 20 50 210 20 50" MarginLeft="0" DefaultCellPaddingLeft="0" DefaultCellPaddingRight="0" IsRowBroken="true" IsFirstRowRepeated="true">
<Row BackgroundColor="#f5f5f5">
<Cell ColumnsSpan="8">
<Table ColumnWidths="40 500">
<Row BackgroundColor="#f5f5f5">
<Cell PaddingLeft="5">
<Text>
<Segment><Image File="http://localhost/Images/PDF/Online_Icon.gif" Type="Gif" /></Segment>
<Segment></Segment>
<Segment></Segment>
<Segment></Segment>
<Segment></Segment>
<Segment></Segment>
<Segment></Segment>
<Segment></Segment>
</Text>
</Cell>
<Cell PaddingTop="6">
<Text LineSpacing="1.8" IsUnicode="false">
<Segment FontName="Arial" Color="rgb 0 0 0" IsTrueTypeFontBold="true" FontSize="10">15/04/2014 14:15|AP00|Low Cost Used Vans</Segment>
</Text>
</Cell>
</Row>
</Table>
</Cell>
</Row>
<Row>
<Cell ColumnsSpan="8" BackgroundColor="#f5f5f5" PaddingTop="5" PaddingRight="5" PaddingBottom="5" PaddingLeft="5">
<Table ColumnWidths="30 200 300" DefaultCellPaddingTop="5" DefaultCellPaddingRight="5" DefaultCellPaddingBottom="5" DefaultCellPaddingLeft="5">
<Row>
<Cell BackgroundColor="#ffffff">
<Image File="http://localhost/images/flags/PL.png" Type="Gif" MarginBottom="1" width="15" height="15" />
</Cell>
<Cell BackgroundColor="#ffffff">
<Text IsSpaced="true" LineSpacing="1.8" IsUnicode="false">
<Segment FontName="Arial" Color="rgb 0 0 0" IsTrueTypeFontBold="true" FontSize="7">AP00,</Segment>
<Segment FontName="Arial" Color="rgb 0 0 0" IsTrueTypeFontBold="false" FontSize="6">
Start Date/Time : 15/04/2014 16:15
End Date/Time : 20/04/2014 12:11</Segment>
</Text>
</Cell>
<Cell BackgroundColor="#ffffff">
<Heading Level="3" IsUnicode="false" LabelWidth="0" MarginTop="1" MarginBottom="1" IsSpaced="true" IsKeptWithNext="true" LineSpacing="1.5">
<Segment FontName="Arial" Color="rgb 0 0 0" IsTrueTypeFontBold="false" FontSize="6"></Segment>
</Heading>
</Cell>
</Row>
</Table>
</Cell>
</Row>
<Row>
<Cell VerticalAlignment="Center" PaddingTop="2" PaddingBottom="2">
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Heading Level="3" IsUnicode="false" LabelWidth="0" MarginTop="1" MarginBottom="1" IsSpaced="true" IsKeptWithNext="true" LineSpacing="1.5" >
<Segment FontName="Arial" Color="rgb 0 0 0" IsTrueTypeFontBold="true" FontSize="7">Description</Segment>
</Heading>
</Cell>
<Cell VerticalAlignment="Center" PaddingTop="2" PaddingBottom="2">
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Heading Level="3" IsUnicode="false" LabelWidth="0" MarginTop="1" MarginBottom="1" IsSpaced="true" IsKeptWithNext="true" LineSpacing="1.5">
<Segment FontName="Arial" Color="rgb 0 0 0" IsTrueTypeFontBold="true" FontSize="7">Colour</Segment>
</Heading>
</Cell>
<Cell VerticalAlignment="Center" PaddingTop="2" PaddingBottom="2">
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Heading Level="3" IsUnicode="false" LabelWidth="0" MarginTop="1" MarginBottom="1" IsSpaced="true" IsKeptWithNext="true" LineSpacing="1.5">
<Segment FontName="Arial" Color="rgb 0 0 0" IsTrueTypeFontBold="true" FontSize="7">KW/PS</Segment>
</Heading>
</Cell>
<Cell Alignment="Left" VerticalAlignment="Center" PaddingTop="2" PaddingBottom="2">
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Image Alignment="Center" File="http://localhost/images/pdf/it-IT_mileage.gif" Type="Gif" MarginRight="1" MarginBottom="1" />
</Cell>
<Cell VerticalAlignment="Center" PaddingTop="2" PaddingBottom="2">
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Heading Level="3" IsUnicode="false" LabelWidth="0" MarginTop="1" MarginBottom="1" IsSpaced="true" IsKeptWithNext="true" LineSpacing="1.5">
<Segment FontName="Arial" Color="rgb 0 0 0" IsTrueTypeFontBold="true" FontSize="7">Reg.</Segment>
</Heading>
</Cell>
<Cell VerticalAlignment="Center" PaddingTop="2" PaddingBottom="2">
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Heading Level="3" IsUnicode="false" LabelWidth="0" MarginTop="1" MarginBottom="1" IsSpaced="true" IsKeptWithNext="true" LineSpacing="1.5">
<Segment FontName="Arial" Color="rgb 0 0 0" IsTrueTypeFontBold="true" FontSize="7">Equipment</Segment>
</Heading>
</Cell>
<Cell VerticalAlignment="Center" PaddingTop="2" PaddingBottom="2">
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Image Alignment="Center" File="http://localhost/images/pdf/it-IT_vat.gif" Type="Gif" MarginRight="1" MarginBottom="1" />
</Cell>
<Cell Alignment="Right" VerticalAlignment="Center" PaddingTop="2" PaddingBottom="2">
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Heading Level="3" IsUnicode="false" LabelWidth="0" MarginTop="1" MarginBottom="1" IsSpaced="true" IsKeptWithNext="true" LineSpacing="1.5">
<Segment FontName="Arial" Color="rgb 0 0 0" IsTrueTypeFontBold="true" FontSize="7">Price</Segment>
</Heading>
</Cell>
</Row>
</Table>
</Cell>
</Row>
<row>
<Cell PaddingLeft="0" PaddingRight="0">
<Table ID="Content" ColumnWidths="130 30 30 20 50 210 20 50" MarginBottom="0" MarginLeft="0" MarginRight="0" MarginTop="0" DefaultCellPaddingLeft="0" DefaultCellPaddingRight="0" DefaultCellPaddingTop="2" IsBroken="false" IsRowBroken="false" IsFirstRowRepeated="true">
<Row>
<Cell>
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Text>
<Segment FontName="Arial" FontSize="6"></Segment>
</Text>
<Text>
<Segment FontName="Arial" FontSize="6"></Segment>
</Text>
</Cell>
<Cell>
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Text IsUnicode="false">
<Segment FontName="Arial" FontSize="6">Unknown Metallic</Segment>
</Text>
</Cell>
<Cell>
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Text IsUnicode="false">
<Segment FontName="Arial" FontSize="6">105 / 143</Segment>
</Text>
</Cell>
<Cell>
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Text IsUnicode ="false">
<Segment FontName="Arial" FontSize="6">50</Segment>
</Text>
</Cell>
<Cell>
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Text IsUnicode="false">
<Segment FontName="Arial" FontSize="6">18/02/2009</Segment>
</Text>
<Text IsUnicode="false">
<Segment FontName="Arial" FontSize="6">5315F1374 </Segment>
</Text>
</Cell>
<Cell>
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Text >
<Segment FontName="Arial" FontSize="5.5">Air Conditioning, Alloy Wheels, Cruise Control, Front Fog Lamps, Stability Control</Segment>
</Text>
</Cell>
<Cell>
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Text Alignment="Right">
<Segment FontName="Arial" FontSize="6">QG</Segment>
</Text>
</Cell>
<Cell>
<Border>
<Bottom Color="rgb 0 0 0" LineWidth="0.5" />
</Border>
<Text Alignment="Right">
<Segment FontName="Arial" FontSize="6">Current</Segment>
</Text>
<Text Alignment="Right">
<Segment FontName="Arial" FontSize="6">£25</Segment>
</Text>
<Text Alignment="Right">
<Segment FontName="Arial" FontSize="6">Buy Now</Segment>
</Text>
<Text Alignment="Right">
<Segment FontName="Arial" FontSize="6">£99,999</Segment>
</Text>
</Cell>
</Row>
</Table>
</Cell>
</row>
</Table>
<Footer MarginTop="5" MarginBottom="5" IsUnicode="false">
<Text Alignment="Left">
<Segment FontName="Arial" FontSize="7" IsTrueTypeFontBold="true" Color="Gray">
QN - Qualifying Net, bid price is exclusive of VAT;
M - Margin, no VAT to reclaim on the purchased item;
QN - Qualifying Gross, bid price is inclusive of VAT;
</Segment>
</Text>
<Text>
<Segment></Segment>
</Text>
<Text Alignment="Center">
<Segment FontName="Arial" FontSize="7" IsTrueTypeFontBold="true">.</Segment>
</Text>
</Footer>
</Section>
</Pdf>