We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.pdf Error "The remote server returned an error: (404) Not Found."

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"?>
15/04/2014 14:15|AP00|Low Cost Used Vans
AP00,
Start Date/Time : 15/04/2014 16:15
End Date/Time : 20/04/2014 12:11
Description
Colour
KW/PS
Reg.
Equipment
Price
Unknown Metallic
105 / 143
50
18/02/2009
5315F1374
Air Conditioning, Alloy Wheels, Cruise Control, Front Fog Lamps, Stability Control
QG
Current
£25
Buy Now
£99,999

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;
.




Hi Mihai,


I have tested the scenario using Aspose.Pdf for .NET 9.1.0 and I am unable to notice any exception/error. However, I have observed that resultant PDF is 0KB. For
the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-36765. We will
investigate this issue in details and will keep you updated on the status of a
correction.

We apologize for your inconvenience.

Hi Nayyer,

I found the issue. In my xml, one image link was pointing to a missing image file. (http://localhost/Images/PDF/AlphabetPoland.jpg)

This is why I got 404 not found.

So no need to investigate it.

Thanks and Regards,

Mihai

Hi Mihai,


We are glad to hear that your problem is resolved. However, during my earlier attempt, I was unable to convert the XML to PDF format. Can you please confirm the current version which you are using ?

PS, as per my observations from your first post, are you using 4.6.0 ?

Hi,


Yes, my version is 4.6.
Do you see any additional problems reg. the code or the xml structure?
What should I do to improve the code?

Regards,
Mihai


Hi Mihai,


Thanks for sharing the details.

In one of your earlier replies, you have stated that once you have specified the correct URL for image object inside XML, the problem is resolved. However during my testing with latest release, the resultant PDF being generated is 0KB even I have updated the image URL’s to correct path. The problem has already been logged in our issue tracking system and as soon as we have some further updates, we will let you know.

Hi,


Ok, this may explain our errors on test/uat and production which occur from time to time…
Please let me know about your updates.

Thanks and Regards,
Mihai

Hi Mihai,


The development team will investigate and try resolving this issue based on its schedule and as soon as we have some further updates, we will let you know.